node.bcrypt.js: Bcrypt fails to install on node v 8.12.0
What went wrong,
Installing bcrypt@3.0.0 on node v 8.12.0 causes an installation error where previous versions (8.11.4) did not. See snippet below for the install log
node-pre-gyp WARN Pre-built binaries not installable for bcrypt@3.0.0 and node@8.12.0 (node-v57 ABI, glibc) (falling back to source compile with node-gyp)
node-pre-gyp WARN Hit error Remote end closed socket abruptly.
make: Entering directory '/home/gerwinb/triply/triply-server/node_modules/bcrypt/build'
CXX(target) Release/obj.target/bcrypt_lib/src/blowfish.o
CXX(target) Release/obj.target/bcrypt_lib/src/bcrypt.o
node-pre-gyp WARN Pre-built binaries not installable for bcrypt@3.0.0 and node@8.12.0 (node-v57 ABI, glibc) (falling back to source compile with node-gyp)
node-pre-gyp WARN Hit error bad download
../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 ());
^
../src/bcrypt.cc: At global scope:
../src/bcrypt.cc:316:1: fatal error: opening dependency file ./Release/.deps/Release/obj.target/bcrypt_lib/src/bcrypt.o.d.raw: No such file or directory
}
^
compilation terminated.
bcrypt_lib.target.mk:103: recipe for target 'Release/obj.target/bcrypt_lib/src/bcrypt.o' failed
make: *** [Release/obj.target/bcrypt_lib/src/bcrypt.o] Error 1
make: Leaving directory '/home/gerwinb/triply/triply-server/node_modules/bcrypt/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/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.15.0-34-generic
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/home/gerwinb/triply/triply-server/node_modules/bcrypt/lib/binding/bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=/home/gerwinb/triply/triply-server/node_modules/bcrypt/lib/binding" "--napi_version=3" "--node_abi_napi=napi"
gyp ERR! cwd /home/gerwinb/triply/triply-server/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 '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/home/gerwinb/triply/triply-server/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/home/gerwinb/triply/triply-server/node_modules/bcrypt/lib/binding --napi_version=3 --node_abi_napi=napi' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/home/gerwinb/triply/triply-server/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.15.0-34-generic
node-pre-gyp ERR! command "/usr/local/bin/node" "/home/gerwinb/triply/triply-server/node_modules/bcrypt/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /home/gerwinb/triply/triply-server/node_modules/bcrypt
node-pre-gyp ERR! node -v v8.12.0
node-pre-gyp ERR! node-pre-gyp -v v0.10.2
node-pre-gyp ERR! not ok
Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/home/gerwinb/triply/triply-server/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/home/gerwinb/triply/triply-server/node_modules/bcrypt/lib/binding --napi_version=3 --node_abi_napi=napi' (1)
Traceback (most recent call last):fo lifecycle bcrypt@3.0.0~install: Failed to exec install script
File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py", line 16, in <module>
sys.exit(gyp.script_main())
File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 545, in script_main
return main(sys.argv[1:])
File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 538, in main
return gyp_main(args)
File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 502, in gyp_main
'cwd': os.getcwd(),
OSError: [Errno 2] No such file or directory
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:345:16)
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.15.0-34-generic
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/home/gerwinb/triply/triply-server/node_modules/bcrypt/lib/binding/bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=/home/gerwinb/triply/triply-server/node_modules/bcrypt/lib/binding" "--napi_version=3" "--node_abi_napi=napi"
gyp ERR! cwd /home/gerwinb/triply/triply-server/node_modules/bcrypt
gyp ERR! node -v v8.12.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN ajv-keywords@3.2.0 requires a peer of ajv@^6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN gulp-debug@4.0.0 requires a peer of gulp@>=4 but none is installed. You must install peer dependencies yourself.
npm WARN tslint-language-service@0.9.9 requires a peer of typescript@>= 2.3.1 < 3 but none is installed. You must install peer dependencies yourself.
npm WARN tslint-microsoft-contrib@5.1.0 requires a peer of typescript@^2.1.0 but none is installed. You must install peer dependencies yourself.
npm WARN @triply/triply-server@2.0.1 No license field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! bcrypt@3.0.0 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bcrypt@3.0.0 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! /home/gerwinb/.npm/_logs/2018-09-14T12_06_58_533Z-debug.log
Which version and OS: Node version 1.12.0 OS: Ubuntu 18.04
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 59
- Comments: 40
Commits related to this issue
- [debops.etherpad] Install 'gyp' Node module The 'gyp' Node module is required for installation of 'bcrypt' module on Node 8+. Related issues: - https://github.com/kelektiv/node.bcrypt.js/issues/650 ... — committed to drybjed/debops by drybjed 6 years ago
- upgrade bcrypt to 3.0.6 to try to fix meteor deploy issue. https://github.com/kelektiv/node.bcrypt.js/issues/650 — committed to winsleague/winsleague by noahsw 5 years ago
- upgrade bcrypt to 3.0.6 to try to fix meteor deploy issue. https://gi… (#566) * upgrade bcrypt to 3.0.6 to try to fix meteor deploy issue. https://github.com/kelektiv/node.bcrypt.js/issues/650 * a... — committed to winsleague/winsleague by noahsw 5 years ago
Please try with v3.0.1
This issue has normally been fix by this PR (https://github.com/kelektiv/node.bcrypt.js/pull/649) but the fix hasn’t been released on the npm repo yet. A release should be done soon with the fix but meanwhile you can link to the branch master of the github repo in your package.json like this :
"bcrypt": "https://github.com/kelektiv/node.bcrypt.js.git#master"This is of course temporary solution.
We’re migrating to bcryptjs, zero dependencies, zero installation headaches.
With Node v8.X.X use bcrypt >= 1.0.3 and < 3.0.0 (source: front page)
I am also facing the same issue still with “bcrypt”: “3.0.1”, node 8.12.0 and npm 6.4.1 on Windows 10
I am still facing this issue on windows. Any update? I tried installing 3.0.1 version, still same error.
Have you at any point installed bcrypt successfully before. If yes, then Try running
yarn add bcrypt@3.0.2ornpm install --save bcrypt@3.0.2. This works for me on node version 8.12.0It seems that the main issue is
node-pre-gypwhich tries to useneedleinstead ofrequestwhile downloading.needleis heavily broken.However, I’m not able to reproduce the build failures. Source compile should always work if you have python2, make and a c++ compiler. The most likely reason is you are running npm as root (under sudo). Source compile will fail in such situations.
Manually adding
requestto dependencies causesnode-pre-gypto use it, which fixes issues associated with downloading pre-built binaries.OHH !! … hangs head in shame
@stridentbean Well I have a docker solution as well but I add a couple more dependecies to make bcrypt work in my image :
If any one still have this problem you can fix it by doing this
or install cmake and gcc on linux by using
Currently using node v8.12 I also had this problem today, fixed with by specifying a specific bcrypt version
yarn add bcrypt@3.0.2This works for me. Device Configuration: Windows 10, npm version 6.4.1Same issue with
bcrypt@3.01running on Ubuntu 18.04 LTS (npm@6.4.1/node@8.12.0).