Everything was working fine until i just update my windows 10 ( 1903 Latest), and just reconfigure my laptop for development, after cloning from git-hub, I was unable to run my nodejs express app due to Bcrypt. I've tried couple of attempts to install bcrypt via npm or yarn but failed. currently I'm at 3.0.4.
node version 12.4.0
npm version 6.9.0
python version 2.7
node-gyp version 3.8.0
node-pre-gyp version 0.12.0
error looks something like this.
C:\Usersasmat\Documents\SMARTOLLDB>npm install [email protected]
[email protected] install C:\Usersasmat\Documents\SMARTOLLDB\node_modulesbcrypt
node-pre-gyp install --fallback-to-build
node-pre-gyp WARN Using needle 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.4/bcrypt_lib-v3.0.4-node-v72-win32-x64-unknown.tar.gz
node-pre-gyp WARN Pre-built binaries not found for [email protected] and [email protected] (node->v72 ABI, unknown) (falling back to source compile with node-gyp)
Warning: unrecognized setting VCCLCompilerTool/MultiProcessorCompilation
Warning: unrecognized setting VCCLCompilerTool/MultiProcessorCompilation
Warning: unrecognized setting VCCLCompilerTool/MultiProcessorCompilation
Warning: unrecognized setting VCCLCompilerTool/MultiProcessorCompilation
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
MSBUILD : error MSB4132: The tools version "2.0" is unrecognized. Available tools versions are "4.0".
gyp ERR! build error
gyp ERR! stack Error:C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exefailed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modulesnpm\node_modules\node-gyp\libbuild.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:200:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Windows_NT 10.0.18362
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "build" "--fallback-to-build" "--module=C:\U
sers\asmat\Documents\SMARTOLLDB\node_modules\bcrypt\lib\binding\bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=C:\Users\asmat\Documents\SMARTOLLDB\node_modules\bcr
ypt\lib\binding" "--napi_version=4" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v72"
gyp ERR! cwd C:\Usersasmat\Documents\SMARTOLLDB\node_modulesbcrypt
gyp ERR! node -v v12.4.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 'C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modulesnpm\node_modules\node-gypbin\node-gyp.js build --fallback-to-build -
-module=C:\Usersasmat\Documents\SMARTOLLDB\node_modulesbcrypt\libbindingbcrypt_lib.node --module_name=bcrypt_lib --module_path=C:\Usersasmat\Documents\SMARTOLLDB\node_modulesbcrypt\li
bbinding --napi_version=4 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1)
node-pre-gyp ERR! stack at ChildProcess.(C:\Usersasmat\Documents\SMARTOLLDB\node_modulesbcrypt\node_modules\node-pre-gyp\lib\util\compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:200:13)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:1021:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
node-pre-gyp ERR! System Windows_NT 10.0.18362
node-pre-gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\asmat\Documents\SMARTOLLDB\node_modules\bcrypt\node_modules\node-pre-gyp\bin\node-pre-gyp" "install" "--f
allback-to-build"
node-pre-gyp ERR! cwd C:\Usersasmat\Documents\SMARTOLLDB\node_modulesbcrypt
node-pre-gyp ERR! node -v v12.4.0
node-pre-gyp ERR! node-pre-gyp -v v0.12.0
node-pre-gyp ERR! not ok
Failed to execute 'C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modulesnpm\node_modules\node-gypbin\node-gyp.js build --fallback-to-build --module=C:\Usersasmat\Document
s\SMARTOLLDB\node_modulesbcrypt\libbindingbcrypt_lib.node --module_name=bcrypt_lib --module_path=C:\Usersasmat\Documents\SMARTOLLDB\node_modulesbcrypt\libbinding --napi_version=4 --no
de_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1)
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! C:\Usersasmat\AppData\Roamingnpm-cache_logs2019-06-21T00_22_51_046Z-debug.log
`
Also getting following erros, when building my lib on ci/cd.
$ yarn
yarn install v1.16.0
[1/4] Resolving packages...
[2/4] Fetching packages...
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
error /builds/wmw/wmw-api/node_modules/bcrypt: Command failed.
Exit code: 1
Command: node-pre-gyp install --fallback-to-build
Arguments:
Directory: /builds/wmw/wmw-api/node_modules/bcrypt
Output:
node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using [email protected]
node-pre-gyp info using [email protected] | linux | x64
node-pre-gyp WARN Using needle for node-pre-gyp https download
node-pre-gyp info check checked for "/builds/wmw/wmw-api/node_modules/bcrypt/lib/binding/bcrypt_lib.node" (not found)
node-pre-gyp http GET https://github.com/kelektiv/node.bcrypt.js/releases/download/v3.0.6/bcrypt_lib-v3.0.6-node-v72-linux-x64-glibc.tar.gz
node-pre-gyp http 404 https://github.com/kelektiv/node.bcrypt.js/releases/download/v3.0.6/bcrypt_lib-v3.0.6-node-v72-linux-x64-glibc.tar.gz
node-pre-gyp WARN Tried to download(404): https://github.com/kelektiv/node.bcrypt.js/releases/download/v3.0.6/bcrypt_lib-v3.0.6-node-v72-linux-x64-glibc.tar.gz
node-pre-gyp WARN Pre-built binaries not found for [email protected] and [email protected] (node-v72 ABI, glibc) (falling back to source compile with node-gyp)
node-pre-gyp http 404 status code downloading tarball https://github.com/kelektiv/node.bcrypt.js/releases/download/v3.0.6/bcrypt_lib-v3.0.6-node-v72-linux-x64-glibc.tar.gz
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp info ok
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp http GET https://nodejs.org/download/release/v12.4.0/node-v12.4.0-headers.tar.gz
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: connect ETIMEDOUT 104.20.22.46:443
gyp ERR! stack at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1054:14)
gyp ERR! System Linux 4.18.0-21-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=/builds/wmw/wmw-api/node_modules/bcrypt/lib/binding/bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=/builds/wmw/wmw-api/node_modules/bcrypt/lib/binding" "--napi_version=4" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v72"
gyp ERR! cwd /builds/wmw/wmw-api/node_modules/bcrypt
gyp ERR! node -v v12.4.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 configure --fallback-to-build --module=/builds/wmw/wmw-api/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/builds/wmw/wmw-api/node_modules/bcrypt/lib/binding --napi_version=4 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/builds/wmw/wmw-api/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:200:13)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:1021:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
node-pre-gyp ERR! System Linux 4.18.0-21-generic
node-pre-gyp ERR! command "/usr/local/bin/node" "/builds/wmw/wmw-api/node_modules/bcrypt/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /builds/wmw/wmw-api/node_modules/bcrypt
node-pre-gyp ERR! node -v v12.4.0
node-pre-gyp ERR! node-pre-gyp -v v0.12.0
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 configure --fallback-to-build --module=/builds/wmw/wmw-api/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/builds/wmw/wmw-api/node_modules/bcrypt/lib/binding --napi_version=4 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1)
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
I got the same issue when building our application's Dockerfile.
We're using Alpine, I had to change the following line:
RUN apk add --no-cache make gcc g++ python && \
npm install
to
RUN apk --no-cache add --virtual builds-deps build-base python && \
npm install
As mentioned in the Wiki: https://github.com/kelektiv/node.bcrypt.js/wiki/Installation-Instructions#alpine-linux-based-images
I don't know when this changed, and it used to work until very recently, but this was the fix for us.
I just resolve that issue on my side by downgrade nodejs to 11.0.4. Bcrypt doesn't support nodejs 12.4.
clearing all caches resolves the issue for me in node docker container 12.4 with yarn 0.16
Is this still an issue? Can this be marked as resolved?
Its fixed with bcrypt 3.0.6 for me
Cannot yarn upgrade bcrypt because error No lockfile in this directory. Run 'yarn install' to generate one..
v11.2.0v1.17.3I managed to solve this by running the command:
sudo apt-get install -y build-essential python and then yarn add bcrypt.
You can find the instructions here:
https://github.com/kelektiv/node.bcrypt.js/wiki/Installation-Instructions
https://github.com/kelektiv/node.bcrypt.js
Most helpful comment
I managed to solve this by running the command:
sudo apt-get install -y build-essential pythonand thenyarn add bcrypt.You can find the instructions here:
https://github.com/kelektiv/node.bcrypt.js/wiki/Installation-Instructions
https://github.com/kelektiv/node.bcrypt.js