node.bcrypt.js: Failed at the bcrypt@1.0.2 install

  • What went wrong: Failed at the bcrypt@0.8.7 install script ‘node-gyp rebuild’.

  • What did you expect to happen: npm install bcrypt --g

  • Which version of nodejs: node@6.9.4 and OS: Windows 8

  • I get the follwoing error while installing ‘bcrypt’ $ npm install bcrypt --g

bcrypt@1.0.2 install C:\Users\MY\AppData\Roaming\npm\node_modules\bcrypt node-pre-gyp install --fallback-to-build

node-pre-gyp ERR! Tried to download(404): https://github.com/kelektiv/node.bcrypt.js/releases/download/v1.0.2/bcrypt_lib-v1.0.2-node-v48-win32-x64.tar.gz node-pre-gyp ERR! Pre-built binaries not found for bcrypt@1.0.2 and node@6.9.4 (node-v48 ABI) (falling back to source compile with node-gyp) Building the projects in this solution one at a time. To enable parallel build, please add the “/m” switch. MSBUILD : error MSB3428: Could not load the Visual C++ component “VCBuild.exe”. To fix this, 1) install the .NET Framework 2.0 SDK, 2) install Microsoft Visual Studio 2005 or 3) add the location of the component to the system path if it is installed elsewhere. [C:\Users\MY\AppData\Roaming\npm\node_modules\bcrypt\build\binding.sln] gyp ERR! build error gyp ERR! stack Error: C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe failed with exit code: 1 gyp ERR! stack at ChildProcess.onExit (C:\Users\MY\AppData\Roaming\npm\node_modules\node-gyp\lib\build.js:276:23) gyp ERR! stack at emitTwo (events.js:106:13) gyp ERR! stack at ChildProcess.emit (events.js:191:7) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12) gyp ERR! System Windows_NT 6.3.9600 gyp ERR! command “C:\Program Files\nodejs\node.exe” “C:\Users\MY\AppData\Roaming\npm\node_modules\node-gyp\bin\node-gyp.js” “build” “–fallback-to-build” “–module=C:\Users\MY\AppData\Roaming\npm\node_modules\bcrypt\lib\binding\bcrypt_lib.node” “–module_name=bcrypt_lib” “–module_path=C:\Users\MY\AppData\Roaming\npm\node_modules\bcrypt\lib\binding” gyp ERR! cwd C:\Users\MY\AppData\Roaming\npm\node_modules\bcrypt gyp ERR! node -v v6.9.4 gyp ERR! node-gyp -v v3.5.0 gyp ERR! not ok node-pre-gyp ERR! build error node-pre-gyp ERR! stack Error: Failed to execute ‘C:\Program Files\nodejs\node.exe C:\Users\MY\AppData\Roaming\npm\node_modules\node-gyp\bin\node-gyp.js build --fallback-to-build --module=C:\Users\MY\AppData\Roaming\npm\node_modules\bcrypt\lib\binding\bcrypt_lib.node --module_name=bcrypt_lib --module_path=C:\Users\MY\AppData\Roaming\npm\node_modules\bcrypt\lib\binding’ (1) node-pre-gyp ERR! stack at ChildProcess.<anonymous> (C:\Users\MY\AppData\Roaming\npm\node_modules\bcrypt\node_modules\node-pre-gyp\lib\util\compile.js:83:29) node-pre-gyp ERR! stack at emitTwo (events.js:106:13) node-pre-gyp ERR! stack at ChildProcess.emit (events.js:191:7) node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:877:16) node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5) node-pre-gyp ERR! System Windows_NT 6.3.9600 node-pre-gyp ERR! command “C:\Program Files\nodejs\node.exe” “C:\Users\MY\AppData\Roaming\npm\node_modules\bcrypt\node_modules\node-pre-gyp\bin\node-pre-gyp” “install” “–fallback-to-build” node-pre-gyp ERR! cwd C:\Users\MY\AppData\Roaming\npm\node_modules\bcrypt node-pre-gyp ERR! node -v v6.9.4 node-pre-gyp ERR! node-pre-gyp -v v0.6.32 node-pre-gyp ERR! not ok Failed to execute ‘C:\Program Files\nodejs\node.exe C:\Users\MY\AppData\Roaming\npm\node_modules\node-gyp\bin\node-gyp.js build --fallback-to-build --module=C:\Users\MY\AppData\Roaming\npm\node_modules\bcrypt\lib\binding\bcrypt_lib.node --module_name=bcrypt_lib --module_path=C:\Users\MY\AppData\Roaming\npm\node_modules\bcrypt\lib\binding’ (1) npm ERR! Windows_NT 6.3.9600 npm ERR! argv “C:\Program Files\nodejs\node.exe” “C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js” “install” “bcrypt” “–g” npm ERR! node v6.9.4 npm ERR! npm v3.10.10 npm ERR! code ELIFECYCLE

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! C:\greenapp\next\rest\npm-debug.log

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 22
  • Comments: 70

Commits related to this issue

Most upvoted comments

Please install compilers and pre-requisites for your systems.

Hi,

same problem on Ubuntu16.04 x64:

> bcrypt@1.0.2 install /root/hpu-dog-back-end/node_modules/bcrypt
> node-pre-gyp install --fallback-to-build

node-pre-gyp ERR! Tried to download(404): https://github.com/kelektiv/node.bcrypt.js/releases/download/v1.0.2/bcrypt_lib-v1.0.2-node-v48-linux-x64.tar.gz 
node-pre-gyp ERR! Pre-built binaries not found for bcrypt@1.0.2 and node@6.9.2 (node-v48 ABI) (falling back to source compile with node-gyp) 
gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR
gyp ERR! configure error 
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack     at failNoPython (/root/.nvm/versions/node/v6.9.2/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:449:14)
gyp ERR! stack     at /root/.nvm/versions/node/v6.9.2/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:353:11
gyp ERR! stack     at F (/root/.nvm/versions/node/v6.9.2/lib/node_modules/npm/node_modules/which/which.js:69:16)
gyp ERR! stack     at E (/root/.nvm/versions/node/v6.9.2/lib/node_modules/npm/node_modules/which/which.js:81:29)
gyp ERR! stack     at /root/.nvm/versions/node/v6.9.2/lib/node_modules/npm/node_modules/which/which.js:90:16
gyp ERR! stack     at /root/.nvm/versions/node/v6.9.2/lib/node_modules/npm/node_modules/which/node_modules/isexe/index.js:44:5
gyp ERR! stack     at /root/.nvm/versions/node/v6.9.2/lib/node_modules/npm/node_modules/which/node_modules/isexe/access.js:8:5
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:123:15)
gyp ERR! System Linux 4.4.0-53-generic
gyp ERR! command "/root/.nvm/versions/node/v6.9.2/bin/node" "/root/.nvm/versions/node/v6.9.2/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/root/hpu-dog-back-end/node_modules/bcrypt/lib/binding/bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=/root/hpu-dog-back-end/node_modules/bcrypt/lib/binding"
gyp ERR! cwd /root/hpu-dog-back-end/node_modules/bcrypt
gyp ERR! node -v v6.9.2
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute '/root/.nvm/versions/node/v6.9.2/bin/node /root/.nvm/versions/node/v6.9.2/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/root/hpu-dog-back-end/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/root/hpu-dog-back-end/node_modules/bcrypt/lib/binding' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/root/hpu-dog-back-end/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at emitTwo (events.js:106:13)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:877:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
node-pre-gyp ERR! System Linux 4.4.0-53-generic
node-pre-gyp ERR! command "/root/.nvm/versions/node/v6.9.2/bin/node" "/root/hpu-dog-back-end/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /root/hpu-dog-back-end/node_modules/bcrypt
node-pre-gyp ERR! node -v v6.9.2
node-pre-gyp ERR! node-pre-gyp -v v0.6.32
node-pre-gyp ERR! not ok 
Failed to execute '/root/.nvm/versions/node/v6.9.2/bin/node /root/.nvm/versions/node/v6.9.2/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/root/hpu-dog-back-end/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/root/hpu-dog-back-end/node_modules/bcrypt/lib/binding' (1)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.0.17: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! Linux 4.4.0-53-generic
npm ERR! argv "/root/.nvm/versions/node/v6.9.2/bin/node" "/root/.nvm/versions/node/v6.9.2/bin/npm" "install" "bcrypt"
npm ERR! node v6.9.2
npm ERR! npm  v3.10.9
npm ERR! code ELIFECYCLE

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

Thanks!

Hi,

I solved the problem,

Dependencies:

npm install node-gyp -g

apt-get install python
apt-get install make
apt-get install g++

But, There are some issues

Tried to download(404): https://github.com/kelektiv/node.bcrypt.js/releases/download/v1.0.2/bcrypt_lib-v1.0.2-node-v48-linux-x64.tar.gz 

Why?

Thanks!

bcrypt.js is very slow

help😨, we need fix🔥

Ubuntu 16.04 on DigitalOcean (512 MB / 1 CPU, 20 GB SSD)

The following worked for me:

  1. Scale droplet up to the 1 GB RAM option

  2. Run each of the following commands

     sudo npm install node-gyp -g
     sudo apt-get install python
     sudo apt-get install make
     sudo apt-get install g++
    
  3. Then try again with:

     npm install bcrypt --save
    
  4. Scale droplet back down to the 512 MB option

For anyone else who can’t get past this but needs bcrypt support, I switched to bcryptjs. API is the same, just a bit slower since it doesn’t use native bindings. Works good enough for me.

We do have pre built binaries uploaded for macOS like it is available for 0.8.7. I’m working to automate the build uploading process and will hopefully be available soon.

Hi,

same problem on OSX:

$ npm i bcrypt --save

bcrypt@1.0.2 install /Users/antwal/Projects/db_replica/node_modules/bcrypt node-pre-gyp install --fallback-to-build

node-pre-gyp ERR! Tried to download(404): https://github.com/kelektiv/node.bcrypt.js/releases/download/v1.0.2/bcrypt_lib-v1.0.2-node-v48-darwin-x64.tar.gz node-pre-gyp ERR! Pre-built binaries not found for bcrypt@1.0.2 and node@6.9.1 (node-v48 ABI) (falling back to source compile with node-gyp)

I’m also having this issue. Platform: Ubuntu 16.04.1 x64

Same problem! (Ubuntu 64)

Same here on Debian, but it’s not surprising because the following url is invalid: https://github.com/kelektiv/node.bcrypt.js/releases/download/v1.0.2/bcrypt_lib-v1.0.2-node-v51-linux-x64.tar.gz

@seonman See #470 If it’s an EC2, installing python and build-essentials (gcc, headers etc) before installing bcrypt.

Is there any workaround? I have to deploy Parse server to AWS and Azure, but I can’t because of this error.

Had the same problem on OS X. Solved by installing the command line tools in Xcode 😃

@anhquande ubuntu 12.04 is very old and does not contain a compliant g++ compiler (nodejs requires a c++11 compiler). You should install gcc-4.9 or higher

On Ubuntu 16.04 I did sudo npm install bcrypt --save instead of npm install bcrypt --save to make it works. This doesn’t work without sudo because I got this message gyp WARN EACCES user "root" does not have permission to access the dev dir "/root/.node-gyp/6.10.0"

@antwal in this post you mentioned, “I have build it from source with node-pre-gyp”. Can you describe the steps you performed? I am having the same issue as @newdesignideas even after updating node, npm, node-pre-gyp, node-gyp, and the xcode command line tools.

Also, who can someone add the tarball file so that we avoid this portion of the error? node-pre-gyp ERR! Tried to download(404): https://github.com/kelektiv/node.bcrypt.js/releases/download/v1.0.2/bcrypt_lib-v1.0.2-node-v51-darwin-x64.tar.gz

[EDIT] It turns out that for me there was an issue with the folder version naming for node-gyp. In the .node-gyp folder (under /Users/YOURUSERNAME/.node-gyp) I renamed the 6.x folder to the version of node I’m using, which allowed the installation to succeed.

I’m also receiving this error when I attempt to deploy to heroku. I’m not sure how to fix this issue…

node-pre-gyp ERR! Tried to download(404): https://github.com/kelektiv/node.bcrypt.js/releases/download/v1.0.2/bcrypt_lib-v1.0.2-node-v48-linux-x64.tar.gz

For those on Ubuntu that are getting this sort of thing:

...
gyp ERR! build error 
gyp ERR! stack Error: not found: make
gyp ERR! stack     at getNotFoundError (/usr/lib/node_modules/npm/node_modules/which/which.js:13:12)
...

You likely just need build-essential: sudo apt-get install build-essential

I have this same issue. The pre-built libraries link is incorrect forcing a fallback build that my system isn’t able to do. Current proper link would be, https://github.com/kelektiv/node.bcrypt.js/archive/v1.0.2.tar.gz as is stated in the package.json but apparently not in the npmjs registry?

Install this globally to make the node-red-admin command available on your path:

npm install -g node-red-admin

Note: you may need to run this with sudo, or from within an Administrator command

shell.

Then use

node-red-admin hash-pw

tool will prompt you for password:

password : abcd1234

$2a$08$ExBqI41sd5ythjkkkklref/6loiiAanRK.we8Zou0H3vMhUXiOfmq

@shivarajnaidu the solution is install build tools and latest version of nodejs

@devKC on heroku like on aws read the documentation for install build tools

@michelgokan I had the same problem on an older version of OSX; El Captian works smoothly; so I think installing everything functions properly even on Sierra

Windows users can try with npm install --global --production windows-build-tools

@seonman , For AWS Beanstalk or EC2, you need install gcc. headers, etc… For EC2 you can use SSH, for Beanstalk you can write a custom config for deploy, here doc