Node.bcrypt.js: Cannot install bcrypt via yarn

Created on 18 Jul 2019  路  5Comments  路  Source: kelektiv/node.bcrypt.js

When I run this command yarn add bcrypt. I got this error:

error D:\nodeprojects\mongo-demo\node_modules\bcrypt: Command failed.
Exit code: 1
Command: node-pre-gyp install --fallback-to-build
Arguments:
Directory: D:\nodeprojects\mongo-demo\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] | win32 | x64
node-pre-gyp WARN Using needle for node-pre-gyp https download
node-pre-gyp info check checked for "D:\nodeprojects\mongo-demo\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-win32-x64-unknown.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-win32-x64-unknown.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-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)
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-win32-x64-unknown.tar.gz

D:\nodeprojects\mongo-demo\node_modules\bcrypt>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js"
clean )  else (node "" clean )
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | win32 | x64
gyp info ok

D:\nodeprojects\mongo-demo\node_modules\bcrypt>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js"
configure --fallback-to-build --module=D:\nodeprojects\mongo-demo\node_modules\bcrypt\lib\binding\bcrypt_lib.node --module_name=bcrypt_lib --module_path=D:\nodeprojects\mongo-demo\node_modules\b
crypt\lib\binding --napi_version=4 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72 )  else (node "" configure --fallback-to-build --module=D:\nodeprojects\mongo-demo\node
_modules\bcrypt\lib\binding\bcrypt_lib.node --module_name=bcrypt_lib --module_path=D:\nodeprojects\mongo-demo\node_modules\bcrypt\lib\binding --napi_version=4 --node_abi_napi=napi --napi_build_
version=0 --node_napi_label=node-v72 )
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | win32 | x64
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack     at PythonFinder.failNoPython (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:484:19)
gyp ERR! stack     at PythonFinder.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:509:16)
gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\polyfills.js:282:31
gyp ERR! stack     at FSReqCallback.oncomplete (fs.js:165:21)
gyp ERR! System Windows_NT 10.0.17763
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure" "--fallback-to-build" "--module=D:\\
nodeprojects\\mongo-demo\\node_modules\\bcrypt\\lib\\binding\\bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=D:\\nodeprojects\\mongo-demo\\node_modules\\bcrypt\\lib\\binding" "--napi
_version=4" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v72"
gyp ERR! cwd D:\nodeprojects\mongo-demo\node_modules\bcrypt
gyp ERR! node -v v12.6.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 'node-gyp.cmd configure --fallback-to-build --module=D:\nodeprojects\mongo-demo\node_modules\bcrypt\lib\binding\bcrypt_lib.node --module_name=bc
rypt_lib --module_path=D:\nodeprojects\mongo-demo\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> (D:\nodeprojects\mongo-demo\node_modules\node-pre-gyp\lib\util\compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:203: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.17763
node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "D:\\nodeprojects\\mongo-demo\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd D:\nodeprojects\mongo-demo\node_modules\bcrypt
node-pre-gyp ERR! node -v v12.6.0
node-pre-gyp ERR! node-pre-gyp -v v0.12.0
node-pre-gyp ERR! not ok
Failed to execute 'node-gyp.cmd configure --fallback-to-build --module=D:\nodeprojects\mongo-demo\node_modules\bcrypt\lib\binding\bcrypt_lib.node --module_name=bcrypt_lib --module_path=D:\nodeprojects\mongo-demo\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/add for documentation about this command.

Environment
node version: 12.6.0
yarn version: 1.17.3

Most helpful comment

I 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

All 5 comments

Have you tried https://github.com/kelektiv/node.bcrypt.js/wiki/Installation-Instructions#microsoft-windows ?

Is this still an issue? Can this be closed?

Have you tried https://github.com/kelektiv/node.bcrypt.js/wiki/Installation-Instructions#microsoft-windows ?

Is this still an issue? Can this be closed?

I have the same problem. Using this link still unable to install bcrypt with yarn, at the same time with npm it is ok. I guess it is not bcrypt issue, but yarn's one.

Yeah, same issue here. When installing with npm, no issues. But whenever I run yarn in a project that uses bcrypt, I end up with Cannot find module 'bcrypt'.

I 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

I 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

Brilliant! Thanks a lot @willianfalbo!!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

japita-se picture japita-se  路  4Comments

youngrrrr picture youngrrrr  路  5Comments

summertong picture summertong  路  5Comments

targos picture targos  路  4Comments

thorlacius picture thorlacius  路  4Comments