Node.bcrypt.js: Heroku build fails - node 8.12.0

Created on 24 Oct 2018  Â·  6Comments  Â·  Source: kelektiv/node.bcrypt.js

Kindly help, I am trying to push my app to heroku and build fails because of bcrypt.

Node version: 8.12.0
bcrypt version: 3.0.2

the following is the error log.

`
-----> Deleting 1 files matching .slugignore patterns.
-----> Node.js app detected

-----> Creating runtime environment

   NPM_CONFIG_LOGLEVEL=error
   NODE_ENV=production
   NODE_MODULES_CACHE=false
   NODE_VERBOSE=false

-----> Installing binaries
engines.node (package.json): 8.12.0
engines.npm (package.json): unspecified (use default)

   Resolving node version 8.12.0...
   Downloading and installing node 8.12.0...
   Using default npm version: 6.4.1

-----> Restoring cache
Caching has been disabled because NODE_MODULES_CACHE=false

-----> Building dependencies
Installing node modules (package.json + package-lock)

   > [email protected] install /tmp/build_75bd6542a5289fee25aaf42e9cf441b9/node_modules/bcrypt
   > node-pre-gyp install --fallback-to-build

   make: Entering directory '/tmp/build_75bd6542a5289fee25aaf42e9cf441b9/node_modules/bcrypt/build'
   make: Entering directory '/tmp/build_75bd6542a5289fee25aaf42e9cf441b9/node_modules/bcrypt/build'
     CXX(target) Release/obj.target/bcrypt_lib/src/blowfish.o
     CXX(target) Release/obj.target/bcrypt_lib/src/blowfish.o
   rm: cannot remove './Release/.deps/Release/obj.target/bcrypt_lib/src/blowfish.o.d.raw': No such file or directory
   bcrypt_lib.target.mk:103: recipe for target 'Release/obj.target/bcrypt_lib/src/blowfish.o' failed
   make: *** [Release/obj.target/bcrypt_lib/src/blowfish.o] Error 1
   make: Leaving directory '/tmp/build_75bd6542a5289fee25aaf42e9cf441b9/node_modules/bcrypt/build'
     CXX(target) Release/obj.target/bcrypt_lib/src/bcrypt.o
   gyp ERR! build error 
   gyp ERR! stack Error: `make` failed with exit code: 2
   gyp ERR! stack     at ChildProcess.onExit (/tmp/build_75bd6542a5289fee25aaf42e9cf441b9/.heroku/node/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
   gyp ERR! stack     at emitTwo (events.js:126:13)
   gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
   gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
   gyp ERR! System Linux 4.4.0-1027-aws
   gyp ERR! command "/tmp/build_75bd6542a5289fee25aaf42e9cf441b9/.heroku/node/bin/node" "/tmp/build_75bd6542a5289fee25aaf42e9cf441b9/.heroku/node/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/tmp/build_75bd6542a5289fee25aaf42e9cf441b9/node_modules/bcrypt/lib/binding/bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=/tmp/build_75bd6542a5289fee25aaf42e9cf441b9/node_modules/bcrypt/lib/binding" "--napi_version=3" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v57"
   gyp ERR! cwd /tmp/build_75bd6542a5289fee25aaf42e9cf441b9/node_modules/bcrypt
   gyp ERR! node -v v8.12.0
   gyp ERR! node-gyp -v v3.8.0
   gyp ERR! not ok 
   node-pre-gyp ERR! build error 
   node-pre-gyp ERR! stack Error: Failed to execute '/tmp/build_75bd6542a5289fee25aaf42e9cf441b9/.heroku/node/bin/node /tmp/build_75bd6542a5289fee25aaf42e9cf441b9/.heroku/node/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/tmp/build_75bd6542a5289fee25aaf42e9cf441b9/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/tmp/build_75bd6542a5289fee25aaf42e9cf441b9/node_modules/bcrypt/lib/binding --napi_version=3 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v57' (1)
   node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/tmp/build_75bd6542a5289fee25aaf42e9cf441b9/node_modules/bcrypt/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
   node-pre-gyp ERR! stack     at emitTwo (events.js:126:13)
   node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
   node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:915:16)
   node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
   node-pre-gyp ERR! System Linux 4.4.0-1027-aws
   node-pre-gyp ERR! command "/tmp/build_75bd6542a5289fee25aaf42e9cf441b9/.heroku/node/bin/node" "/tmp/build_75bd6542a5289fee25aaf42e9cf441b9/node_modules/bcrypt/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
   node-pre-gyp ERR! cwd /tmp/build_75bd6542a5289fee25aaf42e9cf441b9/node_modules/bcrypt
   node-pre-gyp ERR! node -v v8.12.0
   node-pre-gyp ERR! node-pre-gyp -v v0.11.0
   node-pre-gyp ERR! not ok 
   Failed to execute '/tmp/build_75bd6542a5289fee25aaf42e9cf441b9/.heroku/node/bin/node /tmp/build_75bd6542a5289fee25aaf42e9cf441b9/.heroku/node/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/tmp/build_75bd6542a5289fee25aaf42e9cf441b9/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/tmp/build_75bd6542a5289fee25aaf42e9cf441b9/node_modules/bcrypt/lib/binding --napi_version=3 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v57' (1)
   ../src/bcrypt.cc: In function ‘void encode_salt(char*, u_int8_t*, char, u_int16_t, u_int8_t)’:
   ../src/bcrypt.cc:114:1: warning: ‘__builtin___snprintf_chk’ output may be truncated before the last format character [-Wformat-truncation=]
    encode_salt(char *salt, u_int8_t *csalt, char minor, u_int16_t clen, u_int8_t logr)
    ^~~~~~~~~~~
   In file included from /usr/include/stdio.h:862:0,
                    from ../src/bcrypt.cc:34:
   /usr/include/x86_64-linux-gnu/bits/stdio2.h:65:44: note: ‘__builtin___snprintf_chk’ output between 4 and 5 bytes into a destination of size 4
           __bos (__s), __fmt, __va_arg_pack ());
                                               ^
   ../src/bcrypt.cc: In function ‘void bcrypt(const char*, const char*, char*)’:
   ../src/bcrypt.cc:147:1: warning: ‘__builtin___snprintf_chk’ output may be truncated before the last format character [-Wformat-truncation=]
    bcrypt(const char *key, const char *salt, char *encrypted)
    ^~~~~~
   In file included from /usr/include/stdio.h:862:0,
                    from ../src/bcrypt.cc:34:
   /usr/include/x86_64-linux-gnu/bits/stdio2.h:65:44: note: ‘__builtin___snprintf_chk’ output between 4 and 5 bytes into a destination of size 4
           __bos (__s), __fmt, __va_arg_pack ());
                                               ^
     CXX(target) Release/obj.target/bcrypt_lib/src/bcrypt_node.o
   ../src/bcrypt_node.cc:1:10: fatal error: nan.h: No such file or directory
    #include <nan.h>
             ^~~~~~~
   compilation terminated.
   bcrypt_lib.target.mk:103: recipe for target 'Release/obj.target/bcrypt_lib/src/bcrypt_node.o' failed
   make: *** [Release/obj.target/bcrypt_lib/src/bcrypt_node.o] Error 1
   make: Leaving directory '/tmp/build_75bd6542a5289fee25aaf42e9cf441b9/node_modules/bcrypt/build'
   gyp ERR! build error 
   gyp ERR! stack Error: `make` failed with exit code: 2
   gyp ERR! stack     at ChildProcess.onExit (/tmp/build_75bd6542a5289fee25aaf42e9cf441b9/.heroku/node/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
   gyp ERR! stack     at emitTwo (events.js:126:13)
   gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
   gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
   gyp ERR! System Linux 4.4.0-1027-aws
   gyp ERR! command "/tmp/build_75bd6542a5289fee25aaf42e9cf441b9/.heroku/node/bin/node" "/tmp/build_75bd6542a5289fee25aaf42e9cf441b9/.heroku/node/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/tmp/build_75bd6542a5289fee25aaf42e9cf441b9/node_modules/bcrypt/lib/binding/bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=/tmp/build_75bd6542a5289fee25aaf42e9cf441b9/node_modules/bcrypt/lib/binding" "--napi_version=3" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v57"
   gyp ERR! cwd /tmp/build_75bd6542a5289fee25aaf42e9cf441b9/node_modules/bcrypt
   gyp ERR! node -v v8.12.0
   gyp ERR! node-gyp -v v3.8.0
   gyp ERR! not ok 
   npm ERR! code ELIFECYCLE
   npm ERR! errno 1
   npm ERR! [email protected] install: `node-pre-gyp install --fallback-to-build`
   npm ERR! Exit status 1
   npm ERR! 
   npm ERR! Failed at the [email protected] install script.
   npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

   npm ERR! A complete log of this run can be found in:
   npm ERR!     /tmp/npmcache.NGrCP/_logs/2018-10-24T03_32_23_036Z-debug.log

-----> Build failed

   We're sorry this build is failing! You can troubleshoot common issues here:
   https://devcenter.heroku.com/articles/troubleshooting-node-deploys

   If you're stuck, please submit a ticket so we can help:
   https://help.heroku.com/

   Love,
   Heroku

! Push rejected, failed to compile Node.js app.
! Push failed
`

Most helpful comment

It's weird, as on my local system I installed node-gyp and node-pre-gyp globally, and then bcrypt 3.0.2 was installed fine.

When I tried to push it to heruko it failed, then i changed my package.json to master branch as per the previous comment, and now it works well both local and heroku.

When I installed request as per your suggestion, heroku now builds well on bcrypt 3.0.2

Issue resolved

thanks a lot..

All 6 comments

I am sorry for closing and reopening, I have to use the master branch in my nodejs app to solve this issue, is there another solution than this one?

https://github.com/kelektiv/node.bcrypt.js/issues/650#issuecomment-422314710

@rhass99 The current master is what is in v3.0.2, I'm not sure what is wrong with your setup.

You can try adding request module which solves binary downloading problems. npm install request.

Does it work fine on your local system?

It's weird, as on my local system I installed node-gyp and node-pre-gyp globally, and then bcrypt 3.0.2 was installed fine.

When I tried to push it to heruko it failed, then i changed my package.json to master branch as per the previous comment, and now it works well both local and heroku.

When I installed request as per your suggestion, heroku now builds well on bcrypt 3.0.2

Issue resolved

thanks a lot..

https://github.com/agathver/bcrypt-demo

It's all due to needle a package used by node-pre-gyp. I'm migrating away from it to use prebuilt instead.

"bcrypt": "^3.0.2", what about this version, i have the same issues §!?

It some combinations of systems the download of prebuilt binaries fails. It
always works on my system and the CI so I can't figure out why.

installing request as a dependency solves this.

On Sun 28 Oct, 2018, 11:03 PM brahimi mohamed, notifications@github.com
wrote:

"bcrypt": "^3.0.2", what about this version, i have the same issues §!?

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/kelektiv/node.bcrypt.js/issues/666#issuecomment-433725104,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AQCaT36_UI6Uq_JJsbhiWtZU-0a2CqI2ks5upepugaJpZM4X3ETY
.

Was this page helpful?
0 / 5 - 0 ratings