Npm bcrypt and meteor npm bcrypt madness


#62

I am running meteor npm install and it seems binding.gyp can’t be found, which breaks the node-gyp build. When I do the same thing on my Mountain Lion Mac Pro at home it works

jhm at macpro in ~/M/test17                                                                                                                                               17:55:59
 m npm install bcrypt --save

> bcrypt@3.0.0 install /Users/jhm/Meteor/test17/node_modules/bcrypt
> node-pre-gyp install --fallback-to-build

node-pre-gyp WARN Tried to download(404): https://github.com/kelektiv/node.bcrypt.js/releases/download/v3.0.0/bcrypt_lib-v3.0.0-node-v57-darwin-x64-unknown.tar.gz 
node-pre-gyp WARN Pre-built binaries not found for bcrypt@3.0.0 and node@8.11.4 (node-v57 ABI, unknown) (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
  COPY /Users/jhm/Meteor/test17/node_modules/bcrypt/lib/binding/bcrypt_lib.node
  TOUCH Release/obj.target/action_after_build.stamp
+ bcrypt@3.0.0
added 71 packages from 49 contributors and audited 699 packages in 12.331s
found 0 vulnerabilities


#63

Did you find a solution to this?


#64

The solution to this is to have node gyp build tools installed.

For macOS, have XCode and command line tools installed seems to be enough. (Make sure to run Xcode at least once to finish set up)

For Linux (Ubuntu/Debian specifically) sudo apt-get install build-essential - it’ll probably be similar on other Linux platforms - check the notes for node-gyp.

For Windows, install node, then use npm i -g windows-build-tools which will fetch the necessary things to get everything building. You might be able to use meteor’s bundled version of node to do the same - I haven’t tried it (meteor npm i -g windows-build-tools).


#65

Still randomly getting this error. Super frustrating that going into 2019 that this error pops up all the time for no reason. I’ve installed bcrypt more times than I can count.


#66

I still have this problem.
I try any solution via these issue, but still not work.
(Base on Meteor 1.4x)

> bcrypt@3.0.3 install /Volumes/DATA/MeteorApp/microfis/node_modules/bcrypt
> node-pre-gyp install --fallback-to-build

node-pre-gyp WARN Using needle for node-pre-gyp https download
node-pre-gyp WARN Tried to download(404): https://github.com/kelektiv/node.bcrypt.js/releases/download/v3.0.3/bcrypt_lib-v3.0.3-node-v46-darwin-x64-unknown.tar.gz
node-pre-gyp WARN Pre-built binaries not found for bcrypt@3.0.3 and node@4.6.2 (node-v46 ABI, unknown) (falling back to source compile with node-gyp)
  CXX(target) Release/obj.target/bcrypt_lib/src/blowfish.o
warning: include path for stdlibc++ headers not found; pass '-std=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]
1 warning generated.
  CXX(target) Release/obj.target/bcrypt_lib/src/bcrypt.o
warning: include path for stdlibc++ headers not found; pass '-std=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]
1 warning generated.
  CXX(target) Release/obj.target/bcrypt_lib/src/bcrypt_node.o
warning: include path for stdlibc++ headers not found; pass '-std=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]
In file included from ../src/bcrypt_node.cc:1:
../../nan/nan.h:56:10: fatal error: 'algorithm' file not found
#include <algorithm>
         ^~~~~~~~~~~
1 warning and 1 error generated.
make: *** [Release/obj.target/bcrypt_lib/src/bcrypt_node.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/theara/.meteor/packages/meteor-tool/.1.4.2_2.dygc1p.l12lu++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/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 18.2.0
gyp ERR! command "/Users/theara/.meteor/packages/meteor-tool/.1.4.2_2.dygc1p.l12lu++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/bin/node" "/Users/theara/.meteor/packages/meteor-tool/.1.4.2_2.dygc1p.l12lu++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/Volumes/DATA/MeteorApp/microfis/node_modules/bcrypt/lib/binding/bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=/Volumes/DATA/MeteorApp/microfis/node_modules/bcrypt/lib/binding" "--node_abi_napi=node-v46" "--napi_build_version=0" "--node_napi_label=node-v46"
gyp ERR! cwd /Volumes/DATA/MeteorApp/microfis/node_modules/bcrypt
gyp ERR! node -v v4.6.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 '/Users/theara/.meteor/packages/meteor-tool/.1.4.2_2.dygc1p.l12lu++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/bin/node /Users/theara/.meteor/packages/meteor-tool/.1.4.2_2.dygc1p.l12lu++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/Volumes/DATA/MeteorApp/microfis/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/Volumes/DATA/MeteorApp/microfis/node_modules/bcrypt/lib/binding --node_abi_napi=node-v46 --napi_build_version=0 --node_napi_label=node-v46' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/Volumes/DATA/MeteorApp/microfis/node_modules/bcrypt/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at emitTwo (events.js:87:13)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:854:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:222:5)
node-pre-gyp ERR! System Darwin 18.2.0
node-pre-gyp ERR! command "/Users/theara/.meteor/packages/meteor-tool/.1.4.2_2.dygc1p.l12lu++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/bin/node" "/Volumes/DATA/MeteorApp/microfis/node_modules/bcrypt/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /Volumes/DATA/MeteorApp/microfis/node_modules/bcrypt
node-pre-gyp ERR! node -v v4.6.2
node-pre-gyp ERR! node-pre-gyp -v v0.12.0
node-pre-gyp ERR! not ok
Failed to execute '/Users/theara/.meteor/packages/meteor-tool/.1.4.2_2.dygc1p.l12lu++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/bin/node /Users/theara/.meteor/packages/meteor-tool/.1.4.2_2.dygc1p.l12lu++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/Volumes/DATA/MeteorApp/microfis/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/Volumes/DATA/MeteorApp/microfis/node_modules/bcrypt/lib/binding --node_abi_napi=node-v46 --napi_build_version=0 --node_napi_label=node-v46' (1)
npm ERR! Darwin 18.2.0
npm ERR! argv "/Users/theara/.meteor/packages/meteor-tool/.1.4.2_2.dygc1p.l12lu++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/bin/node" "/Users/theara/.meteor/packages/meteor-tool/.1.4.2_2.dygc1p.l12lu++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/bin/npm" "install" "--save" "bcrypt"
npm ERR! node v4.6.2
npm ERR! npm  v3.10.9
npm ERR! code ELIFECYCLE

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 '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:

#67

I try on 2 My PC (Mac).
But the first PC work fine, second don’t work???


#68

Do you have XCode installed, and have you run it (and installed command line tools)? Secondarily, has XCode been updated recently, and have you run it at least once after update to finish the update?


#69

If you are on Windows, try installing windows-build-tools globally through npm: npm i -g windows-build-tools - on Ubuntu/Debian install build-essential apt install build-essential.


#70

I installed ready XCode, Command Line Tools (Work fine).

image


#71

iirc, the thing to watch out for is that when XCode updates, the command line tools are uninstalled (sometimes). Usually you just have to start XCode after an update in order to get everything working again.


#72

When I tried create new with Meteor 1.7x, 1.8x, It work fine.
(Problem on Meteor 1.4x)


#73

I reinstalled xcode CLT, but still don’t work

➜  meteor1.4 meteor npm i -S bcrypt

> bcrypt@3.0.3 install /Volumes/DATA/MeteorApp/meteor1.4/node_modules/bcrypt
> node-pre-gyp install --fallback-to-build

node-pre-gyp WARN Using needle for node-pre-gyp https download
node-pre-gyp WARN Tried to download(404): https://github.com/kelektiv/node.bcrypt.js/releases/download/v3.0.3/bcrypt_lib-v3.0.3-node-v46-darwin-x64-unknown.tar.gz
node-pre-gyp WARN Pre-built binaries not found for bcrypt@3.0.3 and node@4.9.0 (node-v46 ABI, unknown) (falling back to source compile with node-gyp)
  CXX(target) Release/obj.target/bcrypt_lib/src/blowfish.o
warning: include path for stdlibc++ headers not found; pass '-std=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]
1 warning generated.
  CXX(target) Release/obj.target/bcrypt_lib/src/bcrypt.o
warning: include path for stdlibc++ headers not found; pass '-std=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]
1 warning generated.
  CXX(target) Release/obj.target/bcrypt_lib/src/bcrypt_node.o
warning: include path for stdlibc++ headers not found; pass '-std=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]
In file included from ../src/bcrypt_node.cc:1:
../../nan/nan.h:56:10: fatal error: 'algorithm' file not found
#include <algorithm>
         ^~~~~~~~~~~
1 warning and 1 error generated.
make: *** [Release/obj.target/bcrypt_lib/src/bcrypt_node.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/theara/.meteor/packages/meteor-tool/.1.4.4_6.hqcgyw.l4u1q++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/node-gyp/lib/build.js:285: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 18.2.0
gyp ERR! command "/Users/theara/.meteor/packages/meteor-tool/.1.4.4_6.hqcgyw.l4u1q++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/bin/node" "/Users/theara/.meteor/packages/meteor-tool/.1.4.4_6.hqcgyw.l4u1q++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/Volumes/DATA/MeteorApp/meteor1.4/node_modules/bcrypt/lib/binding/bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=/Volumes/DATA/MeteorApp/meteor1.4/node_modules/bcrypt/lib/binding" "--node_abi_napi=node-v46" "--napi_build_version=0" "--node_napi_label=node-v46"
gyp ERR! cwd /Volumes/DATA/MeteorApp/meteor1.4/node_modules/bcrypt
gyp ERR! node -v v4.9.0
gyp ERR! node-gyp -v v3.6.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/Users/theara/.meteor/packages/meteor-tool/.1.4.4_6.hqcgyw.l4u1q++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/bin/node /Users/theara/.meteor/packages/meteor-tool/.1.4.4_6.hqcgyw.l4u1q++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/Volumes/DATA/MeteorApp/meteor1.4/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/Volumes/DATA/MeteorApp/meteor1.4/node_modules/bcrypt/lib/binding --node_abi_napi=node-v46 --napi_build_version=0 --node_napi_label=node-v46' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/Volumes/DATA/MeteorApp/meteor1.4/node_modules/bcrypt/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at emitTwo (events.js:87:13)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:862:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:222:5)
node-pre-gyp ERR! System Darwin 18.2.0
node-pre-gyp ERR! command "/Users/theara/.meteor/packages/meteor-tool/.1.4.4_6.hqcgyw.l4u1q++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/bin/node" "/Volumes/DATA/MeteorApp/meteor1.4/node_modules/bcrypt/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /Volumes/DATA/MeteorApp/meteor1.4/node_modules/bcrypt
node-pre-gyp ERR! node -v v4.9.0
node-pre-gyp ERR! node-pre-gyp -v v0.12.0
node-pre-gyp ERR! not ok
Failed to execute '/Users/theara/.meteor/packages/meteor-tool/.1.4.4_6.hqcgyw.l4u1q++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/bin/node /Users/theara/.meteor/packages/meteor-tool/.1.4.4_6.hqcgyw.l4u1q++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/Volumes/DATA/MeteorApp/meteor1.4/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/Volumes/DATA/MeteorApp/meteor1.4/node_modules/bcrypt/lib/binding --node_abi_napi=node-v46 --napi_build_version=0 --node_napi_label=node-v46' (1)
npm ERR! code ELIFECYCLE
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.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/theara/.npm/_logs/2019-01-10T01_41_08_786Z-debug.log
  • Try brew config
➜  ~ brew config
HOMEBREW_VERSION: 1.9.0
ORIGIN: https://github.com/Homebrew/brew
HEAD: 04b020d09078d9c3067fe8e561cf1b4a23fbee35
Last commit: 17 hours ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: e00f256f282cdecd4b2c6263124aee08e8916784
Core tap last commit: 2 hours ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_LOGS: /Users/theara/Library/Logs/Homebrew
CPU: quad-core 64-bit broadwell
Homebrew Ruby: 2.3.7 => /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby
Clang: 10.0 build 1000
Git: 2.17.2 => /Applications/Xcode.app/Contents/Developer/usr/bin/git
Curl: 7.54.0 => /usr/bin/curl
Java: 11.0.1
macOS: 10.14.2-x86_64
CLT: 10.1.0.0.1.1539992718
Xcode: 10.1

#74

I don’t think bcrypt 3 supports node versions that old. Try with bcrypt@2?


#75

Now work fine meteor npm i -S bcrypt@2.0.1.
Thanks for all :blush: