Node.bcrypt.js: Cant install 3.x version

Created on 2 Oct 2018  Â·  11Comments  Â·  Source: kelektiv/node.bcrypt.js

I get the folowing errors when trying to run npm install with [email protected] on Ubuntu:

root@ubuntu:/var/www/ahri/t# sudo npm install bcrypt

[email protected] install /var/www/ahri/t/node_modules/bcrypt
node-pre-gyp install --fallback-to-build

node-pre-gyp WARN Using needle for node-pre-gyp https download
node-pre-gyp WARN Pre-built binaries not installable for [email protected] and [email protected] (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 '/var/www/ahri/t/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 [email protected] and [email protected] (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 ());
^
sed: can't read ./Release/.deps/Release/obj.target/bcrypt_lib/src/bcrypt.o.d.raw: No such file or directory
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 2
make: Leaving directory '/var/www/ahri/t/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/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-36-generic
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/var/www/ahri/t/node_modules/bcrypt/lib/binding/bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=/var/www/ahri/t/node_modules/bcrypt/lib/binding" "--napi_version=3" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v57"
gyp ERR! cwd /var/www/ahri/t/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/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/var/www/ahri/t/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/var/www/ahri/t/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. (/var/www/ahri/t/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-36-generic
node-pre-gyp ERR! command "/usr/bin/node" "/var/www/ahri/t/node_modules/bcrypt/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /var/www/ahri/t/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 '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/var/www/ahri/t/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/var/www/ahri/t/node_modules/bcrypt/lib/binding --napi_version=3 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v57' (1)
npm WARN enoent ENOENT: no such file or directory, open '/var/www/ahri/t/package.json'
npm WARN t No description
npm WARN t No repository field.
npm WARN t No README data
npm WARN t No license field.

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! /home/ubuntu/.npm/_logs/2018-10-02T13_37_29_787Z-debug.log
root@ubuntu:/var/www/ahri/t# Traceback (most recent call last):
File "/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py", line 16, in
sys.exit(gyp.script_main())
File "/usr/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/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/init.py", line 538, in main
return gyp_main(args)
File "/usr/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/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-36-generic
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/var/www/ahri/t/node_modules/bcrypt/lib/binding/bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=/var/www/ahri/t/node_modules/bcrypt/lib/binding" "--napi_version=3" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v57"
gyp ERR! cwd /var/www/ahri/t/node_modules/bcrypt
gyp ERR! node -v v8.12.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok

Ubuntu version: 18.10
NodeJs version: v8.12.0
Npm: 6.4.1

If i try to install 2.0.1 its works

All 11 comments

The same issue here, getting 404 ->
node-pre-gyp http 404 https://github.com/kelektiv/node.bcrypt.js/releases/download/v3.0.1/bcrypt_lib-v3.0.1-node-v57-linux-x64-musl.tar.gz

Same issue:

node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp WARN Tried to download(404): https://github.com/kelektiv/node.bcrypt.js/releases/download/v3.0.1/bcrypt_lib-v3.0.1-node-v57-win32-x64-unknown.tar.gz
node-pre-gyp WARN Pre-built binaries not found for [email protected] and [email protected] (node-v57 ABI, unknown) (falling back to source compile with node-gyp)

Anyway node-gyp builded bcrypt successfully

OS: Windows 10 x64 1803 / Build 17134.286 (rs4_release.180410-1804)
Node.js: v8.12.0
NPM: 6.4.1
bcrypt: v3.0.1

bcrypt version >= 3 is supported on node version 10 only for node version 8 use version >= 1.0.3.

There is no mention about dropping Node < 10 support in the changelog.
Is this by mistake?

@lahdekorpi I have faced same issue while installing bcrypt on v8.12.0. Please refer to Version Compatibility in README.md.

this module works well with nodejs 8.12 just like it does with nodejs 8.11.4. The compatbility drop is for node 4 and prior. There's a node-gyp compilation issue that seems to occur with nodejs 8.12 which triggers most but not all the time.

Seems to essentially try to use a file that may or may not have been built because the build itself stopped being deterministic with node 8.12.0 for some reason.

@gcs-github I am not able to install bcrypt: v3.0.1 on v8.12. I have not tested it on v8.11.4. However, after updating my nodejs version to v10.11 I was able to install it.

How you have installed it on v8.12 ? I was successful only when I tried older version(v2 of bcrypt).

Yeah, I was successful, but it took several attempts. Most attempts failed, some, rare, succeeded. Hence my diagnosis that the build isn't deterministic for some reason.

Most issues are associated with node-pre-gyp not being able to download the pre-built binaries. add request to the list of dependencies to solve this.

@may215 Binaries for musl are not available (only glibc for now). Please contribute to the CI process if you can, to validate and test the builds.

@muditsaurabh In my systems, the v3.0.1 works with Node 8.12 without any issues

Just a note: you can see the available binaries in the Releases page. Note that there is only glibc versions.

Was this page helpful?
0 / 5 - 0 ratings