The url for binaries seems to have changed and makes npm install fallback to source compile every time (this would not be a big deal if there weren't dependencies on python, make, etc, which makes the installation a problem on alpine docker images of node).
I believe the "remote_path" for the binaries in package.json should be changed to:
"remote_path": "kelektiv/node.bcrypt.js/archive/v{version}/"
(I added a note on the commit that introduced the problem: https://github.com/kelektiv/node.bcrypt.js/commit/27b3b7428523d6cd5126cb7cff02e28d6b605356)
The same thing, after upgrading from 0.8.7 to 1.0.2, I can't build it on linux machine (osx is ok)
Core 4.5.0
gcc (Gentoo 4.8.5 p1.3, pie-0.6.2) 4.8.5

I'm on Arch linux, I was having trouble yesterday but was able to build today. It build successfully on heroku as well.
I was adding the module for the first time
The problem is that if you upload built application to target server and try to do there npm rebuild, it will do nothing with bcrypt now because node-pre-gyp says that binary already exists. But starting project fails, because brypt should be recompiled.
Removing package and installing it again helps, but falls into compilation from source, because node-pre-gyp can't find precompiled package remotely anyway.
So, really, why we need node-pre-gyp, @defunctzombie? It is compiled from source just fine as before 1.0.0 version, but create a lot of questions and confusions for developers who use bcrypt.
Moreover, sometimes target server can have blocked access to outside world (like npm registry) for security reasons, and npm can't download package to install it.
I just tried installing for the first time using npm on windows, and i encounter the same error. However, the problem is that the remote path @pachoclo recommended seems to have no binaries for windows, ie, it hits a 404 when trying to access
https://github.com/kelektiv/node.bcrypt.js/releases/download/v1.0.2/bcrypt_lib-v1.0.2-node-v48-win32-x64.tar.gz
Edit:
I just run the install on a linux machine, and encountered the same error as before. Proceeding to build also failed at node-pre-gyp install --fallback-to-build.
The linux machine is running node 7.1.0
Stuck with same issue here.
See #470 will be resolved when that is implemented
I just added this pull request, it fixed my problem: https://github.com/kelektiv/node.bcrypt.js/pull/489
@klimashkin node-gyp-pre was added largely for windows and (maybe heroku) users who were having issues deploying and working with this project because it required software installed on their machine to build the native bindings. Even tho the readme explicitly says what you need to do, no one reads it or has the experience to deal with binary software compilation. As such, I accepted a PR to enable use of node-gyp-pre (knowing that it does have a fallback to source build if needed) but not realizing the amount of pain in making sure the binary releases are uploaded to github. Sadly I do not see any docs on the readme reminding me of how and where to upload the binaries, so I need to re-learn the process.
The same thing happens on Mac OS, I have the latest Node, npm and Build Tools installed.
> [email protected] install /Users/robertjakobson/Desktop/kruvid-ee/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-v46-darwin-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v46 ABI) (falling back to source compile with node-gyp)
CXX(target) Release/obj.target/bcrypt_lib/src/blowfish.o
c++: error: x86_64: No such file or directory
c++: error: unrecognized option '-arch'
make: *** [Release/obj.target/bcrypt_lib/src/blowfish.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/Users/robertjakobson/Desktop/kruvid-ee/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack at emitTwo (events.js:87:13)
gyp ERR! stack at ChildProcess.emit (events.js:172:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:12)
gyp ERR! System Darwin 16.4.0
gyp ERR! command "/Users/robertjakobson/.meteor/packages/meteor-tool/.1.4.3_1.ju6dmy++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/bin/node" "/Users/robertjakobson/Desktop/kruvid-ee/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/Users/robertjakobson/Desktop/kruvid-ee/node_modules/bcrypt/lib/binding/bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=/Users/robertjakobson/Desktop/kruvid-ee/node_modules/bcrypt/lib/binding"
gyp ERR! cwd /Users/robertjakobson/Desktop/kruvid-ee/node_modules/bcrypt
gyp ERR! node -v v4.7.3
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
node-pre-gyp ERR! build error
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
Does anyone have a interim solution here while waiting on a fix? Is there a release where this isn't an issue?
I strangely get it to work on my mac, but not on ubuntu 16.04
This (and a lot of other problems with this painful package) could be resolved in one short fix:

No node-gyp, node-pre-gyp, Python, C++ and other stuff. No needs to change anything in the code.
https://github.com/dcodeIO/bcrypt.js
that's a little harsh. FWIW, I globally installed node-gyp and node-pre-gyp and then did npm rebuild and it seems to be working quite well on ubuntu 16.04
If you are ok with having your main even loop blocked completely then sure, go for it.
For anybody who is using this package with a Docker node:alpine image, if the base alpine image is version 3.3 or greater there is a virtual flag for apk install which keeps your resulting Docker images small. Make your Dockerfile npm install line look like this:
RUN apk --no-cache add --virtual builds-deps build-base python && npm install && apk del builds-deps
The build-deps is the group name associated with the installed build tools, and it is deleted after the npm install. This way only the built npm modules are left on that image layer.
Using this method, I was able to keep the image size at 75 MB. Without using this method and keeping the build tools, the image size was 260 MB. I verified that the bcrypt module installed correctly by running a test hash after building the image.
What is going on here? @kingjerod's suggestion works but we are boiling the oceans having everyone compile this thing over and over. Lets just fix the link!
Would this be fixed by uploading builds for all architectures instead of just Windows on each release page on github? Always 404s for us when looking for https://github.com/kelektiv/node.bcrypt.js/releases/download/v1.0.2/bcrypt_lib-v1.0.2-node-v48-darwin-x64.tar.gz (also Linux). Only Windows builds for various node versions are available as tarballs. Might be above and beyond the the time commitment of maintainers (or the lack of machines to do builds), but that would solve it at the source.
Thinking of forking and doing custom builds just for our needs, but note forking does not bring over any build artifacts at all. Downside is responsibility for noticing updates to upstream.
@notbrain
Would this be fixed by uploading builds for all architectures instead of just Windows on each release page on github?
Yes. However, the number of architectures are enormous, with hundreds of variables. node-pre-gyp is mostly for windows where the compilaton steps would be frustrating. Similar arrangements for macs can be made.
However for Linux and BSDs, the situation is very difficult. Varying libc versions and variants add to the problem (glibc in mainstream linux vs musl and friends in Alpine linux). There is no one size fits all solution. And fortunately on a Linux machines installing the build tools are fairly easy.
@Agathver Is this something that could be accomplished using a CI tool? With something like Codefresh, you can specify a docker image to use, then a series of shell commands to execute. I'm not sure what it takes to build that tar file.
I'm getting
/app/node_modules/bcrypt/lib/binding/bcrypt_lib.node: Exec format error
even after using @kingjerod solution.
Right when there is require("brcypt") in my code.
Did anyone experience this problem?
@idchlife Are you using an alpine-linux based docker-image ?
@agathver I switched to node-alpine from official repository vs https://hub.docker.com/r/mhart/alpine-node/
and error was gone.
@idchlife which one is the official repository?
@gbahamondezc https://hub.docker.com/_/node/
For all those you didn't get it to work after adding --build-from-source=bcrypt (or equivalent rebuild command after install) - make sure you're not copying your local node_modules into the image by adding .dockerignore file with contents:
node_modules/
cc @idchlife
@agathver node-pre-gyp just released a new version, which support the {libc} token in the path and package name variables. The token resolves to glibc or musl.
See:
@core-process This will be a great blessing to us!
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 :)
Hey @RyabokonRoman thanks!
I faced a similar problem and solved with your suggestion replacing by bcryptjs.
Hey @RyabokonRoman thanks!
Good job!
Most helpful comment
This (and a lot of other problems with this painful package) could be resolved in one short fix:

No node-gyp, node-pre-gyp, Python, C++ and other stuff. No needs to change anything in the code.
https://github.com/dcodeIO/bcrypt.js