I want to install bcrypt in my Express project. I have followed the instructions provided in this page for windows users. I just run the given command npm install --global --production windows-build-tools
and it was successfully like shown in the picture below.
But still when I run
npm i bcrypt
I get the following error:
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.3/bcrypt_lib-v3.0.3-node-v64-win32-x64-unknown.tar.gz node-pre-gyp WARN Pre-built binaries not found for bcrypt@3.0.3 and node@10.15.0 (node-v64 ABI, unknown) (falling back to source compile with node-gyp) gyp ERR! stack Error: Can't find Python executable "python2.7", you can set the PYTHON env variable. ....more errors
I managed to set Python path from this answer here . Now I get this error:
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.3/bcrypt_lib-v3.0.3-node-v64-win32-x64-unknown.tar.gz
node-pre-gyp WARN Pre-built binaries not found for bcrypt@3.0.3 and node@10.15.0 (node-v64 ABI, unknown) (falling back to source compile with node-gyp) Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch. blowfish.cc bcrypt.cc bcrypt_node.cc win_delay_load_hook.cc
全局安装node-gyp包,然后重试npm i bcrypt
npm i -g node-gyp
After so much struggle of installing bcrypt in windows 10, I finally gave up and decided to install alternative package bcrypt.js which is optimized bcrypt written in JavaScript with zero dependencies. Hope this will help someone who is facing similar issue.
Just use npm i bcryptjs
instead of npm i bcrypt
you are either trying to download a package which is no longer present in the GitHub of bcrypt OR the package has moved. Either way, bcrypt is primarily a python package. Using npm, it forces you to use python 2.7 while there is a perfectly functional version of bcrypt for python 3(used it in the past).
I recommend using a node-centric package instead of bcrypt or detaching its use from npm and running it separately with python 3.
I was try to write npm i -g bcrypt
and then write npm i bcrypt
. Now it's working for me!
In my case, the environment variable was a mess.
I've to clean the environment variable regarding node-gyp
. npm life-cycle
module was dependent on node-gyp
and this was present in the path as node-gyp
Also i noticed there was multiple entry for python one is for 2.7 and another is 3.x I kept them both and make sure npm used python 2.7
Then i installed node-gyp
globally and finally npm i bcrypt
Sometimes npm i -g node-gyp
command not works. In my case I just run the command npm i -g node-gyp
and tried to uninstall and install again the bycript and it works.
Delete the bcrypt
npm uninstall bcrypt
Download bcrypt again
npm install bcrypt
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.