reactioncommerce / redoc

redoc - generate documentation from multiple project repos.
GNU General Public License v3.0
20 stars 11 forks source link

bcrypt throws error while installing npms on Ubuntu/Debian #64

Open Capt-Slow opened 7 years ago

Capt-Slow commented 7 years ago

Running npm install on Ubuntu 16.04 will throw: npm ERR! Failed at the bcrypt@1.0.2 install script 'node-pre-gyp install --fallback-to-build'.

The workaround is to run the following before npm install: npm install node-gyp node-pre-gyp

This will generate a warning: npm WARN prefer global node-gyp@3.5.0 should be installed with -g

Installing globally requires sudo...

jshimko commented 7 years ago

Yeah, you generally want to have node-gyp installed globally. You're almost guaranteed to need it eventually while working with Node apps.

Anyway, this is more of a warning than an error. When the correct pre-built bcrypt binary isn't available to be downloaded, it falls back to compiling the c++ code locally. The whole log output...

$ meteor npm install

> bcrypt@1.0.2 install ~/redoc/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 bcrypt@1.0.2 and node@4.6.2 (node-v46 ABI) (falling back to source compile with node-gyp)
  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
  SOLINK_MODULE(target) Release/bcrypt_lib.node
clang: warning: libstdc++ is deprecated; move to libc++ with a minimum deployment target of OS X 10.9
  COPY /Users/Jeremy/code/meteor/reaction/redoc/node_modules/bcrypt/lib/binding/bcrypt_lib.node
  TOUCH Release/obj.target/action_after_build.stamp

...

Note the --fallback-to-build flag that gets used and also this line:

Pre-built binaries not found for bcrypt@1.0.2 and node@4.6.2 (node-v46 ABI) (falling back to source compile with node-gyp)

So I don't think we want to add it as a dependency on the project because you may not always need it and because you should probably have node-gyp installed globally anyway. So maybe a note at the bottom of the readme?