profile
viewpoint

Ask questionsBcrypt failed to install via npm or yarn

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:\Users\asmat\Documents\SMARTOLLDB>npm install bcrypt@3.0.4

bcrypt@3.0.4 install C:\Users\asmat\Documents\SMARTOLLDB\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 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 bcrypt@3.0.4 and node@12.4.0 (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.exe failed with exit code: 1 gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.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:\Users\asmat\Documents\SMARTOLLDB\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 '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:\Users\asmat\Documents\SMARTOLLDB\node_modules\bcrypt\lib\binding\bcrypt_lib.node --module_name=bcrypt_lib --module_path=C:\Users\asmat\Documents\SMARTOLLDB\node_modules\bcrypt\li b\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> (C:\Users\asmat\Documents\SMARTOLLDB\node_modules\bcrypt\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:\Users\asmat\Documents\SMARTOLLDB\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 '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:\Users\asmat\Document s\SMARTOLLDB\node_modules\bcrypt\lib\binding\bcrypt_lib.node --module_name=bcrypt_lib --module_path=C:\Users\asmat\Documents\SMARTOLLDB\node_modules\bcrypt\lib\binding --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! bcrypt@3.0.4 install: node-pre-gyp install --fallback-to-build npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the bcrypt@3.0.4 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:\Users\asmat\AppData\Roaming\npm-cache_logs\2019-06-21T00_22_51_046Z-debug.log `

kelektiv/node.bcrypt.js

Answer questions cebor

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 fsevents@1.2.9: The platform "linux" is incompatible with this module.
info "fsevents@1.2.9" 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 node-pre-gyp@0.12.0
node-pre-gyp info using node@12.4.0 | 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 bcrypt@3.0.6 and node@12.4.0 (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 node-gyp@3.8.0
gyp info using node@12.4.0 | linux | x64
gyp info ok 
gyp info it worked if it ends with ok
gyp info using node-gyp@3.8.0
gyp info using node@12.4.0 | 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.
useful!
source:https://uonfu.com/
Github User Rank List