node.bcrypt.js icon indicating copy to clipboard operation
node.bcrypt.js copied to clipboard

Bcrypt fails to install via npm

Open IrosTheBeggar opened this issue 9 years ago • 38 comments

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! [email protected] install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] 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?

IrosTheBeggar avatar Jun 01 '17 04:06 IrosTheBeggar

The output for me:

> [email protected] install /Users/dwas/Projects/BMW/cml-dashboard-backend/node_modules/bcrypt
> node-pre-gyp install --fallback-to-build

node-pre-gyp info it worked if it ends with ok
node-pre-gyp verb cli [ '/usr/local/Cellar/node/7.9.0/bin/node',
node-pre-gyp verb cli   '/Users/dwas/Projects/BMW/cml-dashboard-backend/node_modules/.bin/node-pre-gyp',
node-pre-gyp verb cli   'install',
node-pre-gyp verb cli   '--fallback-to-build' ]
node-pre-gyp info using node-pre-gyp@https://registry.npmjs.org/node-pre-gyp/-/node-pre-gyp-0.6.32.tgz
node-pre-gyp info using [email protected] | darwin | x64
node-pre-gyp verb command install []
node-pre-gyp ERR! install error 
node-pre-gyp ERR! stack TypeError: Cannot read property 'version' of null
node-pre-gyp ERR! stack     at Object.module.exports.evaluate (/Users/dwas/Projects/BMW/cml-dashboard-backend/node_modules/node-pre-gyp/lib/util/versioning.js:270:32)
node-pre-gyp ERR! stack     at install (/Users/dwas/Projects/BMW/cml-dashboard-backend/node_modules/node-pre-gyp/lib/install.js:168:31)
node-pre-gyp ERR! stack     at Object.self.commands.(anonymous function) [as install] (/Users/dwas/Projects/BMW/cml-dashboard-backend/node_modules/node-pre-gyp/lib/node-pre-gyp.js:50:37)
node-pre-gyp ERR! stack     at run (/Users/dwas/Projects/BMW/cml-dashboard-backend/node_modules/node-pre-gyp/bin/node-pre-gyp:79:30)
node-pre-gyp ERR! stack     at Object.<anonymous> (/Users/dwas/Projects/BMW/cml-dashboard-backend/node_modules/node-pre-gyp/bin/node-pre-gyp:131:1)
node-pre-gyp ERR! stack     at Module._compile (module.js:571:32)
node-pre-gyp ERR! stack     at Object.Module._extensions..js (module.js:580:10)
node-pre-gyp ERR! stack     at Module.load (module.js:488:32)
node-pre-gyp ERR! stack     at tryModuleLoad (module.js:447:12)
node-pre-gyp ERR! stack     at Function.Module._load (module.js:439:3)
node-pre-gyp ERR! System Darwin 16.6.0
node-pre-gyp ERR! command "/usr/local/Cellar/node/7.9.0/bin/node" "/Users/dwas/Projects/BMW/cml-dashboard-backend/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /Users/dwas/Projects/BMW/cml-dashboard-backend/node_modules/bcrypt
node-pre-gyp ERR! node -v v7.9.0
node-pre-gyp ERR! node-pre-gyp -v vhttps://registry.npmjs.org/node-pre-gyp/-/node-pre-gyp-0.6.32.tgz
node-pre-gyp ERR! not ok 
Cannot read property 'version' of null
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] 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!     /Users/dwas/.npm/_logs/2017-06-02T14_04_12_571Z-debug.log

denisw avatar Jun 02 '17 14:06 denisw

We had a similar problem on our project after upgrading to npm v5. Explicitly installing bcrypt (ie npm install bcrypt) was a workaround. Not sure how to tell if this is an npm v5 issue or bcrypt, so I apologize if this comment is creating more noise ;)

warriorpostman avatar Jun 02 '17 17:06 warriorpostman

This as is really a npm v5 bug with node-pre-gyp https://github.com/npm/npm/issues/16728 I would suggest to avoid npm5 for now, or as a workaround, explicitly list bcrypt as the list of dependencies.

recrsn avatar Jul 07 '17 14:07 recrsn

This issue has disappeared in recent versions of npm, though I cannot confirm.

recrsn avatar Aug 12 '17 04:08 recrsn

It has certainly disappeared for us, somewhere at approximately npm v5.3.

warriorpostman avatar Aug 13 '17 18:08 warriorpostman

There were some bug-fixes in npm regarding this, though the linked issue remains open. Will reopen this issue, if the issue reappears.

recrsn avatar Aug 14 '17 02:08 recrsn

Run into same issue while npm install after pulling master branch, as well as on npm install bcrypt

> [email protected] install /home/paulo/Documents/Projects/lara/node_modules/bcrypt
> node-pre-gyp install --fallback-to-build

sh: 1: node-pre-gyp: not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! [email protected] install: `node-pre-gyp install --fallback-to-build`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the [email protected] 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!     /home/paulo/.npm/_logs/2017-09-24T06_26_00_050Z-debug.log1

PaulSebi avatar Sep 24 '17 06:09 PaulSebi

Found a workaround though; run npm install bcrypt before running npm install

PaulSebi avatar Sep 24 '17 06:09 PaulSebi

The problem still occurs - when I tried to deploy my app to Digital Ocean I received exactly the same error log (npm 5.5.1)

bciach avatar Nov 06 '17 14:11 bciach

@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

recrsn avatar Nov 06 '17 14:11 recrsn

What I am receiving is

p install --fallback-to-build` npm ERR! Exit status 2 npm ERR! npm ERR! Failed at the [email protected] 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! /root/.npm/_logs/2017-11-06T15_08_43_688Z-debug.log npm WARN [email protected] No description npm WARN [email protected] No repository field. npm WARN [email protected] No license field. npm ERR! code ELIFECYCLE npm ERR! errno 2 npm ERR! [email protected] install: node npm-rebuild.js npm ERR! Exit status 2 npm ERR! npm ERR! Failed at the [email protected] 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! /root/.npm/_logs/2017-11-06T15_08_43_798Z-debug.log

I red in another source in the internet that bcryptjs will work fine and it does however afterwards I had a problem with chromedriver script... any idea how to fix it?

bciach avatar Nov 06 '17 15:11 bciach

@Rachomir bcryptjs is a different library, it uses slower javascript bcrypt implementation.

Please attach the contents of "/root/.npm/_logs/2017-11-06T15_08_43_798Z-debug.log"

recrsn avatar Nov 06 '17 15:11 recrsn

Don't know if it's a right place to report, but I can also confirm similar problem. I use a fresh DO instance with Ubuntu 16.04.3 and latest Node (9.3.0) and NPM (5.5.1) versions. This problem occurs when I do the "npm install" for a Meteor project build.

themao avatar Dec 21 '17 16:12 themao

@themao what version of Meteor are you using?

bciach avatar Dec 21 '17 21:12 bciach

@Rachomir it's 1.5.1

themao avatar Dec 21 '17 22:12 themao

What about docker image?

bciach avatar Dec 21 '17 22:12 bciach

@Rachomir I don't use docker in my current setup, but maybe I should try

themao avatar Dec 22 '17 08:12 themao

Using Docker from node:8 I get more weird error:

events.js:183 throw er; // Unhandled 'error' event ^

Error: spawn npm ENOENT at _errnoException (util.js:1024:11) at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19) at onErrorNT (internal/child_process.js:372:16) at _combinedTickCallback (internal/process/next_tick.js:138:11) at process._tickCallback (internal/process/next_tick.js:180:9) at Function.Module.runMain (module.js:678:11) at startup (bootstrap_node.js:187:16) at bootstrap_node.js:608:3 npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! [email protected] install: node npm-rebuild.js npm ERR! Exit status 1 npm ERR!

themao avatar Dec 22 '17 10:12 themao

It's odd, but installing bcrypt globally and removing it from package.json didn't help - it still tries to install bcrypt and fails

Wait, the error message actually changed. Now it's about the fibers package. So I assume it has nothing to do with some package, just a general npm/node problem.

themao avatar Dec 22 '17 10:12 themao

So, I "solved" it by downgrading to npm 3.10.3 and node 6.4.0

themao avatar Dec 22 '17 10:12 themao