kelektiv / node.bcrypt.js

bcrypt for NodeJs
MIT License
7.49k stars 518 forks source link

[Solved] bcrypt fails at the install script at node-gyp rebuild #432

Closed conor909 closed 8 years ago

conor909 commented 8 years ago

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!

conor909 commented 8 years ago

@defunctzombie why was this closed?

conor909 commented 8 years ago

For anyone else struggling with this: http://stackoverflow.com/questions/29320201/error-installing-bcrypt-with-npm

I'm now using the bcrypt-nodejs library. npm install --save bcrypt-nodejs && npm uninstall --save bcrypt

I've been using it without any issues for a while now.

andrewjmead commented 8 years ago

I have the same issue. Shame to to see it getting closed without a conversation. Thanks for the info @conor909.

conor909 commented 8 years ago

@andrewjmead I just had to edit my previous comment, it's not the same api, you'll need to update your code.

bmorelli25 commented 8 years ago

I've been trying to solve this for hours...

Finally working! Thank you @conor909 for the help, your solution worked for me.

scheung38 commented 8 years ago

Thanks Conor

I had issue

https://forums.meteor.com/t/another-mup-failed-deployed-any/29277

and now this solved it for me:

$npm install --save bcrypt-nodejs && npm uninstall --save bcrypt
shashidharhr commented 8 years ago

@conor909 you f**ing life saver man I almost died whole day trying to solve this shit. I love you so much <3.

iamdarknight commented 8 years ago

Spent 5 hours trying to get bcrypt to work. SO MUCH THANX HACKER!

conor909 commented 8 years ago

I think your file in newproject/mean/module 3/start/app.js on line 17 is trying to import or require bcrypt. If that's the case change "bcrypt" to "bcrypt-nodejs"

tanc commented 7 years ago

You need to install with npm version 3: https://github.com/RocketChat/Rocket.Chat/issues/5210 npm install -g npm@3

fp5885 commented 7 years ago

Thanks to tanc. I'm installing kibana4.5 and was getting hung on the bcrypt dependency. npm install -g npm@3 worked for me.

adammoisa commented 7 years ago

@conor909 Thumbs up, smiley, party, and heart for you!

arorashivani commented 7 years ago

on 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

azarus commented 7 years ago

Horrible that this is an one year old issue and is still out there causing pain (Y)

hofman-p commented 6 years ago

Still causes issues in 2018

recrsn commented 6 years ago

@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

eduarduo commented 6 years ago

I had the same error and verified that I was using node10, I changed via nvm to node9 and it worked

DeepakDonde commented 6 years ago

My solution: 1)Go to visual studio code 2)Open package.json 3)Delete bcrypt dependency from package.json 4)Now open terminal and run npm install bcrypt 5)Restart visual studio code(Always a good practice if things not working :))

aardvarkk commented 6 years ago

I followed all of the installation instructions at the above link using node 10 and Ubuntu 18.04 and am still having errors building bcrypt.

sayhicoelho commented 6 years ago

migrated to https://www.npmjs.com/package/bcryptjs and now everything is working

spences10 commented 6 years ago

Changing to node 9 fixed the issue for me 👍

LukeV111 commented 6 years ago

What solved the issue for me was changing my XCode command Line Tools for 10.1 to 9.4 (I have both versions installed).

If you have both versions installed you can do this by going to Xcode > Preferences > Locations and switching you Command Line Tools there. It seems XCOde 10+ is currently incompatible.

Nchaka commented 6 years ago

The problem is, installing the bcrypt module re-launches the npm install command after you've explicitly did:

npm install

Note: 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 install

But 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 install with 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

bidipeppercrap commented 6 years ago

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

arulk8 commented 5 years ago

i installed bcrypt which is compatible to node version given in there website. it worked for me https://www.npmjs.com/package/bcrypt

Ishaaqh commented 5 years ago

If u are using nodejs then use sudo npm install --save bcryptjs.and restart the server.

mlnima commented 5 years ago

please use this package to solve the problem https://www.npmjs.com/package/bcryptjs

rickithadi commented 5 years ago

This seems to have something to do with npm versions. i had the problem running 11.6.0 but it works fine with 6.1.0, i just used nvm to change versions and npm installed again

mfc3370 commented 5 years ago

@conor909 still thanking u in 2019. IS it not possible to collab with the bcrypt module programmers? It's crazy everyone using mac has to first npm i bcrypt, then fall into the pit and start looking for a solution.

akhilasok commented 5 years ago

install npm i node-pre-gyp after that use npm i bcrypt

KingZee commented 5 years ago

This is an issue with node-gyp, it doesn't work with Python 3+.

sudo apt install python2.7    
ln -s /usr/bin/python2.7 /usr/bin/python

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.

ihemantkumar commented 5 years ago
npm ERR! errno 1
npm ERR! bcrypt@3.0.3 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the bcrypt@3.0.3 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

I am having this same issue in node v 10.14, 10.15, 10.16. I have tried your above mentioned solutions, but none is working for me.

ihemantkumar commented 5 years ago

This seems to have something to do with npm versions. i had the problem running 11.6.0 but it works fine with 6.1.0, i just used nvm to change versions and npm installed again

If this is the case, how to find which npm version is suitable?

iamnoel commented 5 years ago

What an interesting experience. I was getting tons of errors while trying to install for quite a while; at some point I did an npm install node-gyp... and I'm not sure if I added anything else.. still getting various errors until eventually when I was about to give up.. I tried npm install --save bcrypt That solved it for me. Not sure if it will help anyone else but just adding the --save flag allowed me to install bcrypt without all of the errors I was getting before (which were very similar to MANY of the errors I see above)

Good luck everyone!

rehan-sattar commented 5 years ago

Still causing this error in 2019.I just migrated to bcryptjs, worked 100% fine. link to the package: https://www.npmjs.com/package/bcryptjs

aikhan commented 5 years ago

on 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

It worked it worked :D

SachindeepRedsky commented 5 years ago

my solution is: Use this command sudo yum groupinstall 'Development Tools'

algaly commented 4 years ago

First uninstall bcrypt npm uninstall --save bcrypt then: npm install --save bcryptjs

see : link bcryptjs

PolymathWhiz commented 4 years ago

Best solution is to use the node version compatible with the bcrypt version

imrizwan commented 4 years ago

Still causing this error in 2020 :/

Vanguard90 commented 4 years ago

Best solution is to use the node version compatible with the bcrypt version

For anyone reading this thread, this, in combination of:

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

solved my problem. I'm currently using Node version 12.15 by the way. Upgraded bcrypt from 1.0.3 to 3.0.8. Everything works without any problems.

sanjay-nag commented 4 years ago

I'm still facing this issue!

Bcrypt - 3.0.5 Node - 13.12.0

Tried this (https://github.com/kelektiv/node.bcrypt.js/wiki/Installation-Instructions) didn't work!

Stack trace-

make: Entering directory /home/ec2-user/kafka-backend/node_modules/bcrypt/build' CXX(target) Release/obj.target/bcrypt_lib/src/blowfish.o CXX(target) Release/obj.target/bcrypt_lib/src/bcrypt.o CXX(target) Release/obj.target/bcrypt_lib/src/bcrypt_node.o In file included from /home/ec2-user/.cache/node-gyp/13.12.0/include/node/node.h:67:0, from ../node_modules/nan/nan.h:53, from ../src/bcrypt_node.cc:1: /home/ec2-user/.cache/node-gyp/13.12.0/include/node/v8.h:1576:58: warning: ‘deprecated’ attribute directive ignored [-Wattributes] Local<Value> export_value); ^ /home/ec2-user/.cache/node-gyp/13.12.0/include/node/v8.h:5073:30: warning: ‘deprecated’ attribute directive ignored [-Wattributes] inline bool IsNeuterable() const { ^ /home/ec2-user/.cache/node-gyp/13.12.0/include/node/v8.h:5087:22: warning: ‘deprecated’ attribute directive ignored [-Wattributes] inline void Neuter() { Detach(); } ^ /home/ec2-user/.cache/node-gyp/13.12.0/include/node/v8.h:5550:76: warning: ‘deprecated’ attribute directive ignored [-Wattributes] ArrayBufferCreationMode mode = ArrayBufferCreationMode::kExternalized); ^ /home/ec2-user/.cache/node-gyp/13.12.0/include/node/v8.h:6938:28: warning: ‘deprecated’ attribute directive ignored [-Wattributes] size_t code_range_size() const { return code_range_size_ / kMB; } ^ /home/ec2-user/.cache/node-gyp/13.12.0/include/node/v8.h:6940:46: warning: ‘deprecated’ attribute directive ignored [-Wattributes] void set_code_range_size(size_t limit_in_mb) { ^ /home/ec2-user/.cache/node-gyp/13.12.0/include/node/v8.h:6944:38: warning: ‘deprecated’ attribute directive ignored [-Wattributes] size_t max_semi_space_size_in_kb() const; ^ /home/ec2-user/.cache/node-gyp/13.12.0/include/node/v8.h:6946:56: warning: ‘deprecated’ attribute directive ignored [-Wattributes] void set_max_semi_space_size_in_kb(size_t limit_in_kb); ^ /home/ec2-user/.cache/node-gyp/13.12.0/include/node/v8.h:6948:31: warning: ‘deprecated’ attribute directive ignored [-Wattributes] size_t max_old_space_size() const { return max_old_generation_size_ / kMB; } ^ /home/ec2-user/.cache/node-gyp/13.12.0/include/node/v8.h:6950:49: warning: ‘deprecated’ attribute directive ignored [-Wattributes] void set_max_old_space_size(size_t limit_in_mb) { ^ /home/ec2-user/.cache/node-gyp/13.12.0/include/node/v8.h:6954:31: warning: ‘deprecated’ attribute directive ignored [-Wattributes] size_t max_zone_pool_size() const { return max_zone_pool_size_; } ^ /home/ec2-user/.cache/node-gyp/13.12.0/include/node/v8.h:6956:43: warning: ‘deprecated’ attribute directive ignored [-Wattributes] void set_max_zone_pool_size(size_t bytes) { max_zone_pool_size_ = bytes; } ^ /home/ec2-user/.cache/node-gyp/13.12.0/include/node/v8.h:7730:75: warning: ‘deprecated’ attribute directive ignored [-Wattributes] V8_DEPRECATED("Use version with parameter.") virtual void TraceEpilogue() {} ^ /home/ec2-user/.cache/node-gyp/13.12.0/include/node/v8.h:7785:48: warning: ‘deprecated’ attribute directive ignored [-Wattributes] const v8::TracedGlobal<v8::Value>& handle); ^ /home/ec2-user/.cache/node-gyp/13.12.0/include/node/v8.h:8455:36: warning: ‘deprecated’ attribute directive ignored [-Wattributes] Local<Context> GetEnteredContext(); ^ /home/ec2-user/.cache/node-gyp/13.12.0/include/node/v8.h:8768:75: warning: ‘deprecated’ attribute directive ignored [-Wattributes] void AddMicrotasksCompletedCallback(MicrotasksCompletedCallback callback); ^ /home/ec2-user/.cache/node-gyp/13.12.0/include/node/v8.h:8776:78: warning: ‘deprecated’ attribute directive ignored [-Wattributes] void RemoveMicrotasksCompletedCallback(MicrotasksCompletedCallback callback); ^ /home/ec2-user/.cache/node-gyp/13.12.0/include/node/v8.h:9207:59: warning: ‘deprecated’ attribute directive ignored [-Wattributes] static void SetNativesDataBlob(StartupData* startup_blob); ^ /home/ec2-user/.cache/node-gyp/13.12.0/include/node/v8.h:9220:61: warning: ‘deprecated’ attribute directive ignored [-Wattributes] static void SetFlagsFromString(const char* str, int length); ^ /home/ec2-user/.cache/node-gyp/13.12.0/include/node/v8.h:9305:70: warning: ‘deprecated’ attribute directive ignored [-Wattributes] const char* snapshot_blob); ^ /home/ec2-user/.cache/node-gyp/13.12.0/include/node/v8.h:9341:75: warning: ‘deprecated’ attribute directive ignored [-Wattributes] static bool TryHandleSignal(int signal_number, void* info, void* context); ^ In file included from /home/ec2-user/.cache/node-gyp/13.12.0/include/node/node.h:72:0, from ../node_modules/nan/nan.h:53, from ../src/bcrypt_node.cc:1: /home/ec2-user/.cache/node-gyp/13.12.0/include/node/v8-platform.h:371:71: warning: ‘deprecated’ attribute directive ignored [-Wattributes] virtual void CallOnForegroundThread(Isolate* isolate, Task* task) = 0; ^ /home/ec2-user/.cache/node-gyp/13.12.0/include/node/v8-platform.h:381:73: warning: ‘deprecated’ attribute directive ignored [-Wattributes] double delay_in_seconds) = 0; ^ /home/ec2-user/.cache/node-gyp/13.12.0/include/node/v8-platform.h:392:75: warning: ‘deprecated’ attribute directive ignored [-Wattributes] virtual void CallIdleOnForegroundThread(Isolate* isolate, IdleTask* task) { ^ In file included from /usr/include/c++/4.8.5/cassert:43:0, from /home/ec2-user/.cache/node-gyp/13.12.0/include/node/node_object_wrap.h:26, from ../node_modules/nan/nan.h:55, from ../src/bcrypt_node.cc:1: ../node_modules/nan/nan_object_wrap.h: In destructor ‘virtual Nan::ObjectWrap::~ObjectWrap()’: ../node_modules/nan/nan_object_wrap.h:24:25: error: ‘class Nan::Persistent<v8::Object>’ has no member named ‘IsNearDeath’ assert(persistent().IsNearDeath()); ^ ../node_modules/nan/nan_object_wrap.h: In static member function ‘static void Nan::ObjectWrap::WeakCallback(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)’: ../node_modules/nan/nan_object_wrap.h:127:26: error: ‘class Nan::Persistent<v8::Object>’ has no member named ‘IsNearDeath’ assert(wrap->handle_.IsNearDeath()); ^ make: *** [Release/obj.target/bcrypt_lib/src/bcrypt_node.o] Error 1 make: Leaving directory/home/ec2-user/kafka-backend/node_modules/bcrypt/build' gyp ERR! build error gyp ERR! stack Error: make failed with exit code: 2 gyp ERR! stack at ChildProcess.onExit (/home/ec2-user/.nvm/versions/node/v13.12.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23) gyp ERR! stack at ChildProcess.emit (events.js:315:20) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12) gyp ERR! System Linux 4.14.171-105.231.amzn1.x86_64 gyp ERR! command "/home/ec2-user/.nvm/versions/node/v13.12.0/bin/node" "/home/ec2-user/.nvm/versions/node/v13.12.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/home/ec2-user/kafka-backend/node_modules/bcrypt/lib/binding/bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=/home/ec2-user/kafka-backend/node_modules/bcrypt/lib/binding" "--napi_version=6" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v79" gyp ERR! cwd /home/ec2-user/kafka-backend/node_modules/bcrypt gyp ERR! node -v v13.12.0 gyp ERR! node-gyp -v v5.1.0 gyp ERR! not ok node-pre-gyp ERR! build error node-pre-gyp ERR! stack Error: Failed to execute '/home/ec2-user/.nvm/versions/node/v13.12.0/bin/node /home/ec2-user/.nvm/versions/node/v13.12.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/home/ec2-user/kafka-backend/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/home/ec2-user/kafka-backend/node_modules/bcrypt/lib/binding --napi_version=6 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v79' (1) node-pre-gyp ERR! stack at ChildProcess. (/home/ec2-user/kafka-backend/node_modules/node-pre-gyp/lib/util/compile.js:83:29) node-pre-gyp ERR! stack at ChildProcess.emit (events.js:315:20) node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:1026:16) node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5) node-pre-gyp ERR! System Linux 4.14.171-105.231.amzn1.x86_64 node-pre-gyp ERR! command "/home/ec2-user/.nvm/versions/node/v13.12.0/bin/node" "/home/ec2-user/kafka-backend/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" node-pre-gyp ERR! cwd /home/ec2-user/kafka-backend/node_modules/bcrypt node-pre-gyp ERR! node -v v13.12.0 node-pre-gyp ERR! node-pre-gyp -v v0.12.0 node-pre-gyp ERR! not ok Failed to execute '/home/ec2-user/.nvm/versions/node/v13.12.0/bin/node /home/ec2-user/.nvm/versions/node/v13.12.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/home/ec2-user/kafka-backend/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/home/ec2-user/kafka-backend/node_modules/bcrypt/lib/binding --napi_version=6 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v79' (1) npm WARN canvas-backend@1.0.0 No description npm WARN canvas-backend@1.0.0 No repository field.

npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! bcrypt@3.0.5 install: node-pre-gyp install --fallback-to-build npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the bcrypt@3.0.5 install script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

recrsn commented 4 years ago

@sanjay-nag Use bcrypt >= v3.0.8 with NodeJS 13

sanjay-nag commented 4 years ago

@sanjay-nag Use bcrypt >= v3.0.8 with NodeJS 13 @agathver, thank you for the reply. It worked when I downgraded my node version to 10.x.x

salsa-project commented 4 years ago

For anyone else struggling with this: http://stackoverflow.com/questions/29320201/error-installing-bcrypt-with-npm

I'm now using the bcrypt-nodejs library. npm install --save bcrypt-nodejs && npm uninstall --save bcrypt

I've been using it without any issues for a while now.

Ty .. working great

AzeemAleem commented 4 years ago

@conor909 Thanks Dear Successfully run the code

JavaLavaMT commented 4 years ago

@tanc > pm install -g npm@3

solid fix!

yashi32 commented 4 years ago

For anyone else struggling with this: http://stackoverflow.com/questions/29320201/error-installing-bcrypt-with-npm

I'm now using the bcrypt-nodejs library. npm install --save bcrypt-nodejs && npm uninstall --save bcrypt

I've been using it without any issues for a while now.

@conor909 u saved the day man!!!

PaulMabille commented 4 years ago

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.

yashi32 commented 4 years ago

@PaulMabille can you tell the alternative to bcrypt.