Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bcrypt fails to install via npm #509

Closed
IrosTheBeggar opened this issue Jun 1, 2017 · 39 comments
Closed

Bcrypt fails to install via npm #509

IrosTheBeggar opened this issue Jun 1, 2017 · 39 comments

Comments

@IrosTheBeggar
Copy link

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?

@denisw
Copy link

denisw commented Jun 2, 2017

The output for me:

> bcrypt@1.0.2 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 node@7.9.0 | 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! 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.
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

@warriorpostman
Copy link

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 ;)

@recrsn
Copy link
Collaborator

recrsn commented Jul 7, 2017

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

@recrsn
Copy link
Collaborator

recrsn commented Aug 12, 2017

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

@warriorpostman
Copy link

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

@recrsn
Copy link
Collaborator

recrsn commented Aug 14, 2017

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

@recrsn recrsn closed this as completed Aug 14, 2017
@PaulSebi
Copy link

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

> bcrypt@1.0.3 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! bcrypt@1.0.3 install: `node-pre-gyp install --fallback-to-build`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the bcrypt@1.0.3 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
Copy link

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

@recrsn recrsn reopened this Sep 24, 2017
@recrsn recrsn closed this as completed Oct 21, 2017
@bciach
Copy link

bciach commented Nov 6, 2017

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)

@recrsn
Copy link
Collaborator

recrsn commented Nov 6, 2017

@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

@bciach
Copy link

bciach commented Nov 6, 2017

What I am receiving is

p install --fallback-to-build`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the bcrypt@1.0.3 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 meteor-dev-bundle@0.0.0 No description
npm WARN meteor-dev-bundle@0.0.0 No repository field.
npm WARN meteor-dev-bundle@0.0.0 No license field.
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! meteor-dev-bundle@0.0.0 install: node npm-rebuild.js
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the meteor-dev-bundle@0.0.0 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?

@recrsn
Copy link
Collaborator

recrsn commented Nov 6, 2017

@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"

@themao
Copy link

themao commented Dec 21, 2017

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.

@bciach
Copy link

bciach commented Dec 21, 2017

@themao what version of Meteor are you using?

@themao
Copy link

themao commented Dec 21, 2017

@Rachomir it's 1.5.1

@bciach
Copy link

bciach commented Dec 21, 2017

What about docker image?

@themao
Copy link

themao commented Dec 22, 2017

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

@themao
Copy link

themao commented Dec 22, 2017

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! meteor-dev-bundle@0.0.0 install: node npm-rebuild.js
npm ERR! Exit status 1
npm ERR!

@themao
Copy link

themao commented Dec 22, 2017

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
Copy link

themao commented Dec 22, 2017

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

@felipecaldas
Copy link

Having exactly the same error using Meteor Up and DO. Node 8.x and NPM 5.5
I will pursue trying to get a fix using these versions instead of downgrading. If I find anything I will post here

@nicolas-mosch
Copy link

I have the same issue. Tried with multiple versions of node and npm (4.7, 6.4, 9.4). Every time I got the same problem

@recrsn
Copy link
Collaborator

recrsn commented Jan 25, 2018

@nicolas-mosch EPERM?

@worldofnick
Copy link

Seeing the same issue.

@debadattatabi
Copy link

Finally after many research I solve this problem. So, guys those who are facing this problem just do the below processes,

I just installed python and set the environment variables now it's working perfect for me.

Install Python (while installing in windows you can get the option for add path in environment variables, just tick the check box or else)
Set the path in environment variables
Now store the downloaded python.exe file in this directory "c:\Python\27\python.exe"
Now run this cmd in terminal npm config set python "c:\Python\27\python.exe"
Now do npm install or run your project.
guys just check it out may be you solve your problem :)

@andresarslanian
Copy link

andresarslanian commented Mar 23, 2018

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 using
const 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.

@fsalazarh
Copy link

fsalazarh commented Sep 26, 2018

Try add bcrypt to package.json and after execute npm install.

This worked for me!

@invegat
Copy link

invegat commented Dec 22, 2018

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

@MajidJafari
Copy link

MajidJafari commented Jan 6, 2019

For me, it was to make python 2.7 as the node python version. My problem was that I had python 3.4 which is unsupported based on node-gyp npm page.

@Jayakhanthan
Copy link

Manually changing "bcrypt":"^1.0.3" to "bcrypt":"^3.0.2" in the package.json worked fine for me.

@0xShynn
Copy link

0xShynn commented Jun 13, 2019

Manually changing "bcrypt":"^1.0.3" to "bcrypt":"^3.0.2" in the package.json worked fine for me.

It worked ! Thanks a lot

@malalayMayar
Copy link

malalayMayar commented Aug 24, 2019

I had the same problem. changing the bcrypt version to latest(3.0.6) worked for me.

@amaneer94
Copy link

amaneer94 commented Oct 29, 2019

Following steps saved my day:

  • npm uninstall bcrypt -S or remove bcrypt from package.json
  • Deleted package-lock.json
  • npm i bcrypt@latest -S

@Codestructor
Copy link

Thank you! This worked!

@dfdeagle47
Copy link

dfdeagle47 commented May 17, 2020

FWIW, fixed it by running

npm rebuild
npm install

YMMV, as we all know npm works in mysterious ways.

Edit:

Alternative that seemed to have worked as well (source)

npm rebuild bcrypt --update-binary

Although I don't really see this parameter in the documentation...

@Shiv-create
Copy link

Following steps saved my day:

  • npm uninstall bcrypt -S or remove bcrypt from package.json
  • Deleted package-lock.json
  • npm i bcrypt@latest -S

This worked for me! Thanks

@guiaixiao
Copy link

Manually changing "bcrypt":"^1.0.3" to "bcrypt":"^3.0.2" in the package.json worked fine for me.

This worked for me! Thanks

@4skinSkywalker
Copy link

Having this issue with bcrypt in pipedream... bcryptjs works fine

@shahabshahidi
Copy link

I also have this error when installing bcrypt

npm ERR! Code 1
npm ERR! path C:\Users\ttl\Desktop\testnpm\node_modules\bcrypt
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node-pre-gyp install --fallback-to-build
npm ERR! Failed to execute '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=C:\Users\ttl\Desktop\testnpm\node_modules\bcrypt\lib\binding\napi-v3\bcrypt_lib.node --module_name=bcrypt_lib --module_path=C:\Users\ttl\Desktop\testnpm\node_modules\ bcrypt\lib\binding\napi-v3 --napi_version=9 --node_abi_napi=napi --napi_build_version=3 --node_napi_label=napi-v3' (1)
npm ERR! node-pre-gyp info it worked if it ends with ok
npm ERR! node-pre-gyp info using node-pre-gyp@1.0.11
npm ERR! node-pre-gyp info using node@20.12.1 | win32 | x64
npm ERR! node-pre-gyp info check checked for "C:\Users\ttl\Desktop\testnpm\node_modules\bcrypt\lib\binding\napi-v3\bcrypt_lib.node" (not found)
.
.
.
I don't know what the problem is!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests