node.bcrypt.js: Bcrypt fails to install via npm
I run a package called mStream that uses bcrypt. Several users have reported that when installing mStream via npm they get the following bcrypt error:
npm ERR! Linux 4.4.0-78-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "mstream"
npm ERR! node v7.10.0
npm ERR! npm v4.2.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! bcrypt@1.0.2 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bcrypt@1.0.2 install script 'node-pre-gyp install --fallback-to-build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the bcrypt package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-pre-gyp install --fallback-to-build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs bcrypt
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls bcrypt
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /root/.npm/_logs/2017-05-31T19_40_42_507Z-debug.log
The workaround is pretty easy luckily. If you clone the repository via github and run npm install bcrypt will install just fine. Any idea what’s causing this bug?
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 10
- Comments: 39
Found a workaround though; run
npm install bcryptbefore runningnpm installSo, I “solved” it by downgrading to npm 3.10.3 and node 6.4.0
Following steps saved my day:
npm uninstall bcrypt -Sor remove bcrypt from package.jsonnpm i bcrypt@latest -SManually changing “bcrypt”:“^1.0.3” to “bcrypt”:“^3.0.2” in the package.json worked fine for me.
Hi guys… I had the same problem… I hope it helps someone because I lost hours with this, but instead of using bcrypt I’ve used bcryptjs (found here)
So instead of using:
const bcrypt = require('bcrypt');I’m usingconst bcrypt = require('bcryptjs');I read that is a little bit less performant. At least for my application it works great without further problems.
I hope it helps.
Trying to get a year old program to install, “npm upgrade” failed, had to manually change "“bcrypt”: “^1.0.3”, to "“bcrypt”: “^3.0.2”, was getting 404 errors when 1.0.3 was part of the download url
For me, it was to make
python 2.7as the node python version. My problem was that I had python 3.4 which is unsupported based onnode-gypnpm page.Try add
bcryptto package.json and after executenpm install.This worked for me!
I had the same problem. changing the bcrypt version to latest(3.0.6) worked for me.
@Rachomir, Do you have build-essentials and python ? You shouldn’t receive this error, as node-pre-gyp will not attempt to rebuild the binaries. We already have compatible binaries uploaded.
Still some more info, and the np,-debug.log will help
This issue has disappeared in recent versions of npm, though I cannot confirm.