node.bcrypt.js: [Solved] bcrypt fails at the install script at node-gyp rebuild
I get the folowing errors when trying to run npm install with "bcrypt": "^0.8.6" as a devDependency
error bcrypt@0.8.7 install: `node-gyp rebuild`
error Exit status 1
error Failed at the bcrypt@0.8.7 install script.
error This is most likely a problem with the bcrypt package,
error not with npm itself.
error Tell the author that this fails on your system:
error node-gyp rebuild
error You can get their info via:
error npm owner ls bcrypt
error There is likely additional logging output above.
error System Windows_NT 10.0.10586
error command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
error cwd C:\Users\username\Documents\my-app
error node -v v4.2.4
error npm -v 1.4.3
error code ELIFECYCLE
verbose exit [ 1, true ]
Thanks!
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 87
Commits related to this issue
- - bcrypt, bug failed install on Linux servers ... (https://github.com/kelektiv/node.bcrypt.js/issues/432#issuecomment-230595650) + install bcryptjs ~ modify packages and user schema — committed to perriea/node-api by perriea 7 years ago
- - bcrypt, bug failed install on Linux servers ... (https://github.com/kelektiv/node.bcrypt.js/issues/432#issuecomment-230595650) + install bcryptjs ~ modify packages and user schema — committed to perriea/node-api by perriea 7 years ago
- - bcrypt, bug failed install on Linux servers ... (https://github.com/kelektiv/node.bcrypt.js/issues/432#issuecomment-230595650) + install bcryptjs ~ modify packages and user schema — committed to perriea/node-api by perriea 7 years ago
- - bcrypt, bug failed install on Linux servers ... (https://github.com/kelektiv/node.bcrypt.js/issues/432#issuecomment-230595650) + install bcryptjs ~ modify packages and user schema — committed to perriea/node-api by perriea 7 years ago
- replaced lib bcrypt by lib bcrypt-nodejs https://github.com/kelektiv/node.bcrypt.js/issues/432 — committed to BooksOnWall/StoryMaker by tombombadilom 5 years ago
- fix deploy error 錯誤訊息: npm ERR! Failed at the bcrypt@5.0.1 install script. 解法參考: https://github.com/kelektiv/node.bcrypt.js/issues/432 — committed to outshaker/foodmap-backend by outshaker 3 years ago
- deploy to AWS - API 開放給外部來源呼叫 - 調整檔案結構 - 增加 dotenv 支援 .env 導入環境變數 - config 支援動態載入環境變數 - 修正少數錯字 修正部署時的錯誤: - ServiceError - Configuration validation exception: Unknown or duplicate parameter: NodeComm... — committed to outshaker/foodmap-backend by outshaker 3 years ago
- deploy to AWS - 調整檔案結構,確保部署時的腳本運作正常 - 使用 .env 檔案引入環境變數 (依賴 dotenv 套件) - config.js 使用環境變數 - API 開放所有外部來源,以利之後瀏覽器測試 - 修正部分錯字 修正部署時的錯誤: - ServiceError - Configuration validation exception: Unknown or d... — committed to outshaker/foodmap-backend by outshaker 3 years ago
For anyone else struggling with this: http://stackoverflow.com/questions/29320201/error-installing-bcrypt-with-npm
I’m now using the
bcrypt-nodejslibrary.npm install --save bcrypt-nodejs && npm uninstall --save bcryptI’ve been using it without any issues for a while now.
@conor909 you f**ing life saver man I almost died whole day trying to solve this shit. I love you so much ❤️.
@hofman-p This happens if your machine is incorrectly setup. We have comprehensive installation instructions https://github.com/kelektiv/node.bcrypt.js/wiki/Installation-Instructions
Please read them before opening an issue, if it is an obvious case, the issue will be closed without any information, or a link at most depending on the maintainers’ mood
Thanks Conor
I had issue
https://forums.meteor.com/t/another-mup-failed-deployed-any/29277
and now this solved it for me:
I have the same issue. Shame to to see it getting closed without a conversation. Thanks for the info @conor909.
My solution: 1)Go to visual studio code 2)Open
package.json3)Delete bcrypt dependency frompackage.json4)Now open terminal and runnpm install bcrypt5)Restart visual studio code(Always a good practice if things not working 😃)Still causes issues in 2018
You need to install with npm version 3: https://github.com/RocketChat/Rocket.Chat/issues/5210
npm install -g npm@3Still causing this error in 2020 😕
This bcrypt module has been a pain for so many years, unbelievable!
install
npm i node-pre-gypafter that usenpm i bcryptif anyone still struggle with bcrypt on Amazon Linux, try bcryptjs. coz bcrypt-nodejs has deprecated now
npm install --save bcryptjs && npm uninstall --save bcrypt
replace your const bcrypt = require(‘bcrypt’) with const bcrypt = require(‘bcryptjs’) and everything will work fine : )
still causing this error in 2021
First uninstall bcrypt npm uninstall --save bcrypt then: npm install --save bcryptjs
see : link
please use this package to solve the problem https://www.npmjs.com/package/bcryptjs
I had the same error and verified that I was using node10, I changed via nvm to node9 and it worked
Horrible that this is an one year old issue and is still out there causing pain (Y)
Still causing this error in 2019.I just migrated to
bcryptjs, worked 100% fine. link to the package: https://www.npmjs.com/package/bcryptjson mac os following solution worked for me Install Xcode Run sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
sources https://github.com/nodejs/node-gyp/issues/569
Spent 5 hours trying to get bcrypt to work. SO MUCH THANX HACKER!
The solution to this error is : First npm uninstall bcrypt or npm uninstall bcrypt-nodejs ( if bcrypt or bcrypt-nodejs exist in package.json Then npm install bcryptjs
I try to use bcrypt-nodejs but it only helps to push to heroku without error , but it will give error when hashing and genSalt , I think npm install bcryptjs is the best solution
Ubuntu 18.04
it worked for me -> sudo apt-get install build-essential
no other solution present here had worked.
It was a new machine (azure VM) and I had forgotten and installed this package.
If u are using nodejs then use
sudo npm install --save bcryptjs.and restart the server.The problem is, installing the bcrypt module re-launches the npm install command after you’ve explicitly did:
npm installNote: For some packages. You’ll notice bcrypt has its own node_modules folder as a module itself.
To remedy the situation of node-gyp or node-pre-gyp being locked out of the equation, you first need to be sure to NOT do sudo as in:
sudo npm installBut the trick is, you do need sudo. Therefore you’ll have to go with this document https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally
Once that is done, you’ll be able to simply do
npm installwith the proper privileges, and rebuild successfully.If you are using nvm, you’ll have to set the prefix as recommended here: https://stackoverflow.com/questions/34718528/nvm-is-not-compatible-with-the-npm-config-prefix-option
Changing to node 9 fixed the issue for me 👍
migrated to https://www.npmjs.com/package/bcryptjs and now everything is working
In node v14.16.0 I only tried:
<npm install --save bcrypt@5.0.0>. It worked.
*It used a request for node-pre-gyp https download.
SOLUTION: (worked for me)
Install C++ Compiler, make, and Python 2 (Well Linux has it already). https://github.com/kelektiv/node.bcrypt.js/wiki/Installation-Instructions#fedora
It’s something to do with the way the snap package for npm’s confiment works, if you manually run it outside the sandbox, or with an fnm-provided version of
nodeit works fine.Fine:
Not fine:
I’m unable to e.g.
stracethrough snap-confine and don’t care about it, so can’t guess what that error 7 really means, but I’m going to guess “snap sandbox kill”, despite sandboxing being off.I had a similar issue in a project using bcrypt. It appears that it came from the bcrypt version in my package.json file. I solved it by reinstalling bcrypt. I would not recommend using bcrypt-nodejs as it is depreciated.
For anyone reading this thread, this, in combination of:
solved my problem. I’m currently using Node version
12.15by the way. Upgraded bcrypt from1.0.3to3.0.8. Everything works without any problems.This is an issue with node-gyp, it doesn’t work with Python 3+.
Install python 2.7 and set its executable as the default, then install again. If you need python3 later you can always replace the symbolic link.
Summary of what helped me for the following setup:
For bcrypt to work, you need
node-gypas stated in the package docs.node-gypitself requires other dependencies:make,gcc, andpython. The first two you can get one-by-one or by installingbuild-essential:node-gypworks withpython3, don’t let bcrypt’s wiki page that was referenced in this github issue a lot confuse you.And then as suggested by @dantaeusb, clean cache and, I would add, remove node modules, that last piece was crucial for my setup to finally start working:
Thank you sooo much. It worked on Mac - M1 👍 I firstly changed my node version to current stable version. Then I applied this method
I got this error while installing in docker and for me updating the version of bcrypt to 5.0.0 in package.json worked for me.
This works for me on Ubuntu 18.04 EC2 Instance. Thanks!
Best solution is to use the node version compatible with the bcrypt version