Npm bcrypt and meteor npm bcrypt madness


#41

Remove accounts-password package then run meteor npm install --save bcrypt once done install back account-password if you are using it.


#42

Thanks, unfortunately did not work. Every time I install a new NPM package, the Note still reappears. :disappointed:


#43

@rijk do it one more time running this sequentially

meteor remove accounts-password
meteor npm uninstall --save bcrypt
meteor npm install --save bcrypt

are you running on linux, macOS, or windows?


#44

It appears that using the built-in version of node (meteor npm) does not trigger this problem! So it’s probably a Node 5-related issue. Thanks for the pointer, and thanks @ralpheiligan for the help as well :+1:


#45

Guys, having the same issues here. I always get a 404 error message with a node pre-gyp, even when I deploy to Meteor:

2017-06-12 19:42:21+01:00> bcrypt@1.0.2 install /app/bundle/programs/server/npm/node_modules/bcrypt
v122
2017-06-12 19:42:21+01:00> node-pre-gyp install --fallback-to-build
v122
2017-06-12 19:42:21+01:00
v122
2017-06-12 19:42:22+01:00node-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-linux-x64.tar.gz
v122
2017-06-12 19:42:22+01:00node-pre-gyp ERR! Pre-built binaries not found for bcrypt@1.0.2 and node@4.7.3 (node-v46 ABI) (falling back to source compile with node-gyp)
v122
2017-06-12 19:42:23+01:00make: Entering directory `/app/bundle/programs/server/npm/node_modules/bcrypt/build'
v122
2017-06-12 19:42:23+01:00 CXX(target) Release/obj.target/bcrypt_lib/src/blowfish.o
v122
2017-06-12 19:42:24+01:00 CXX(target) Release/obj.target/bcrypt_lib/src/bcrypt.o
v122
2017-06-12 19:42:24+01:00 CXX(target) Release/obj.target/bcrypt_lib/src/bcrypt_node.o
v122
2017-06-12 19:42:25+01:00 SOLINK_MODULE(target) Release/obj.target/bcrypt_lib.node
v122
2017-06-12 19:42:25+01:00 COPY Release/bcrypt_lib.node
v122
2017-06-12 19:42:25+01:00 COPY /app/bundle/programs/server/npm/node_modules/bcrypt/lib/binding/bcrypt_lib.node
v122
2017-06-12 19:42:25+01:00 TOUCH Release/obj.target/action_after_build.stamp
v122
2017-06-12 19:42:25+01:00make: Leaving directory `/app/bundle/programs/server/npm/node_modules/bcrypt/build'

#46

Further info on this. The bcrypt of accounts-base package seems to have a problem with Mongo version 3.4 and above. It constantly crashes our frontend app which is developed on Galaxy. See the log:


2017-06-14 00:54:23+01:00Note: you are using a pure-JavaScript implementation of bcrypt.
y7nb
2017-06-14 00:54:23+01:00While this implementation will work correctly, it is known to be
y7nb
2017-06-14 00:54:23+01:00approximately three times slower than the native implementation.
y7nb
2017-06-14 00:54:23+01:00In order to use the native implementation instead, run
y7nb
2017-06-14 00:54:23+01:00
y7nb
2017-06-14 00:54:23+01:00 meteor npm install --save bcrypt
y7nb
2017-06-14 00:54:23+01:00
y7nb
2017-06-14 00:54:23+01:00in the root directory of your application.
y7nb
2017-06-14 00:54:24+01:00
y7nb
2017-06-14 00:54:24+01:00/app/bundle/programs/server/node_modules/fibers/future.js:313
y7nb
2017-06-14 00:54:24+01:00	throw(ex);
y7nb
2017-06-14 00:54:24+01:00	^
y7nb
2017-06-14 00:54:24+01:00MongoError: no SNI name sent, make sure using a MongoDB 3.4+ driver/shell.
y7nb
2017-06-14 00:54:24+01:00 at Object.Future.wait (/app/bundle/programs/server/node_modules/fibers/future.js:449:15)
y7nb
2017-06-14 00:54:24+01:00 at new MongoConnection (packages/mongo/mongo_driver.js:219:27)
y7nb
2017-06-14 00:54:24+01:00 at new MongoInternals.RemoteCollectionDriver (packages/mongo/remote_collection_driver.js:4:16)
y7nb
2017-06-14 00:54:24+01:00 at Object.<anonymous> (packages/mongo/remote_collection_driver.js:38:10)
y7nb
2017-06-14 00:54:24+01:00 at Object.defaultRemoteCollectionDriver (packages/underscore.js:784:19)
y7nb
2017-06-14 00:54:24+01:00 at new Mongo.Collection (packages/mongo/collection.js:103:40)
y7nb
2017-06-14 00:54:24+01:00 at AccountsServer.AccountsCommon (packages/accounts-base/accounts_common.js:23:18)
y7nb
2017-06-14 00:54:24+01:00 at new AccountsServer (packages/accounts-base/accounts_server.js:18:5)
y7nb
2017-06-14 00:54:24+01:00 at meteorInstall.node_modules.meteor.accounts-base.server_main.js (packages/accounts-base/server_main.js:9:12)
y7nb
2017-06-14 00:54:24+01:00 at fileEvaluate (packages/modules-runtime.js:181:9)
y7nb
2017-06-14 00:54:24+01:00 - - - - -
y7nb
2017-06-14 00:54:24+01:00 at Function.MongoError.create (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb-core/lib/error.js:31:11)
y7nb
2017-06-14 00:54:24+01:00 at /app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb-core/lib/connection/pool.js:483:72
y7nb
2017-06-14 00:54:24+01:00 at authenticateStragglers (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb-core/lib/connection/pool.js:429:16)
y7nb
2017-06-14 00:54:24+01:00 at [object Object].messageHandler (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb-core/lib/connection/pool.js:463:5)
y7nb
2017-06-14 00:54:24+01:00 at TLSSocket.<anonymous> (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb-core/lib/connection/connection.js:309:22)
y7nb
2017-06-14 00:54:24+01:00 at emitOne (events.js:77:13)
y7nb
2017-06-14 00:54:24+01:00 at TLSSocket.emit (events.js:169:7)
y7nb
2017-06-14 00:54:24+01:00 at readableAddChunk (_stream_readable.js:153:18)
y7nb
2017-06-14 00:54:24+01:00 at TLSSocket.Readable.push (_stream_readable.js:111:10)
y7nb
2017-06-14 00:54:24+01:00 at TLSWrap.onread (net.js:537:20)
y7nb
2017-06-14 00:54:25+01:00Application exited with code: 1
y7nb
2017-06-14 00:54:29+01:00The container has crashed. A new container will be started to replace it.

#47

In your first message, the 404 error should be harmless. It just means a pre-built binary was not available and that Meteor will have to compile it for you, which by the looks of the logs, it did!

As to your second post – there is no connection between the bcrypt error and the (older, based on your Meteor version) MongoDB Node driver not working with the (newer) MongoDB 3.4 server which Mongo Atlas hosts. But we can discuss that the other, more relevant post you have about this (Galaxy deployment breaks accounts-base package with MongoDb 3.4+). :slight_smile:


#48

This worked for me. Thanks!


#49

Make sure you always call npm from under meteor. You may be doing that, but in your writeup you did not include meteor in your install line - it should always have meteor in front meteor npm --install [somepackage] --save


#50

What if I need accounts-password?


#51

You really just need to make sure you install it from the meteor node version. You can either sync your system node and npm versions to meteor and then run the command to instlal bcrypt, or you can just make sure you always (even for other modules!) use meteor npm to install and remove npm modules, and never npm directly.

You may need to remove bcrypt then put it back, though I’ve found simply reinstalling it correctly fixes up that message every time.

meteor npm uninstall --save bcrypt
meteor npm i -S bcrypt

This goes for yarn too:

meteor npm i -g yarn
meteor yarn add bcrypt

#52

@fbosler follow this steps

meteor remove accounts-password
meteor npm uninstall --save bcrypt
meteor npm install --save bcrypt
meteor add accounts-password

#53

Removing npm-bcrypt from my .meteor/versions file worked for me.

Note: I’m on a Mac.


#54

This has returned after the 1.6 update. Following the steps results in an error:

W20171031-14:13:38.485(1)? (STDERR) Note: you are using a pure-JavaScript implementation of bcrypt.
W20171031-14:13:38.485(1)? (STDERR) While this implementation will work correctly, it is known to be
W20171031-14:13:38.486(1)? (STDERR) approximately three times slower than the native implementation.
W20171031-14:13:38.486(1)? (STDERR) In order to use the native implementation instead, run
W20171031-14:13:38.486(1)? (STDERR) 
W20171031-14:13:38.486(1)? (STDERR)   meteor npm install --save bcrypt
W20171031-14:13:38.486(1)? (STDERR) 
W20171031-14:13:38.486(1)? (STDERR) in the root directory of your application.
^C
Uniti-iMac-6:transmate Rijk$ meteor npm install --save bcrypt

> bcrypt@0.8.7 install /Volumes/iMac HDD/Rijk/Code/Projects/transmate/node_modules/bcrypt
> node-gyp rebuild

  CXX(target) Release/obj.target/bcrypt_lib/src/blowfish.o
clang: error: no such file or directory: 'HDD/Rijk/.meteor/packages/meteor-tool/.1.6.0.1tp1xc0++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/include/node'
clang: error: no such file or directory: 'HDD/Rijk/.meteor/packages/meteor-tool/.1.6.0.1tp1xc0++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/src'
clang: error: no such file or directory: 'HDD/Rijk/.meteor/packages/meteor-tool/.1.6.0.1tp1xc0++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/deps/uv/include'
clang: error: no such file or directory: 'HDD/Rijk/.meteor/packages/meteor-tool/.1.6.0.1tp1xc0++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/deps/v8/include'
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 (/Volumes/iMac HDD/Rijk/.meteor/packages/meteor-tool/.1.6.0.1tp1xc0++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack     at emitTwo (events.js:125:13)
gyp ERR! stack     at ChildProcess.emit (events.js:213:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Darwin 17.0.0
gyp ERR! command "/Volumes/iMac HDD/Rijk/.meteor/packages/meteor-tool/.1.6.0.1tp1xc0++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/bin/node" "/Volumes/iMac HDD/Rijk/.meteor/packages/meteor-tool/.1.6.0.1tp1xc0++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" "rebuild"
gyp ERR! cwd /Volumes/iMac HDD/Rijk/Code/Projects/transmate/node_modules/bcrypt
gyp ERR! node -v v8.8.1
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok 
npm WARN transmate@1.0.0 No description
npm WARN transmate@1.0.0 No repository field.
npm WARN transmate@1.0.0 No license field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! bcrypt@0.8.7 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the bcrypt@0.8.7 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!     /Volumes/iMac HDD/Rijk/.npm/_logs/2017-10-31T13_14_01_877Z-debug.log

Edit: this did the trick for me

meteor npm uninstall --save bcrypt
meteor npm i -S bcrypt

#56

I experimented an extension of this issue (at least the same hints) during a deploy on Heroku.
If it’s useful for someone.

After updating from 1.5.2 to 1.6 and installing bcrypt through meteor npm install --save bcrypt (following the same message as Npm bcrypt and meteor npm bcrypt madness), I got an issue during a deploy on Heroku:

bcrypt@0.8.7 install /tmp/build_b2451433de0d0c8436fd56b8477f7a94/Ontokrat-Bob-27fbbb79d8f08abd380478310f9cd107406cbfe4/.meteor/heroku_build/app/programs/server/npm/node_modules/bcrypt
node-gyp rebuild
make: Entering directory '/tmp/build_b2451433de0d0c8436fd56b8477f7a94/Ontokrat-Bob-27fbbb79d8f08abd380478310f9cd107406cbfe4/.meteor/heroku_build/app/programs/server/npm/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
SOLINK_MODULE(target) Release/obj.target/bcrypt_lib.node
COPY Release/bcrypt_lib.node
make: Leaving directory '/tmp/build_b2451433de0d0c8436fd56b8477f7a94/Ontokrat-Bob-27fbbb79d8f08abd380478310f9cd107406cbfe4/.meteor/heroku_build/app/programs/server/npm/node_modules/bcrypt/build’
fibers@1.0.15 install /tmp/build_b2451433de0d0c8436fd56b8477f7a94/Ontokrat-Bob-27fbbb79d8f08abd380478310f9cd107406cbfe4/.meteor/heroku_build/app/programs/server/npm/node_modules/fibers
node build.js || nodejs build.js
linux-x64-57 exists; testing
Binary is fine; exiting
npm ERR! Invalid version: "https://registry.npmjs.org/agent-base/-/agent-base-2.1.1.tgz"
npm ERR! A complete log of this run can be found in:
npm ERR! /app/.npm/_logs/2017-11-03T23_02_31_333Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! meteor-dev-bundle@0.0.0 install: node npm-rebuild.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the meteor-dev-bundle@0.0.0 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! /app/.npm/_logs/2017-11-03T23_02_31_371Z-debug.log
! Push rejected, failed to compile Node.js app.
! Push failed

I just performed (and nothing else), according to @ralpheiligan advices, a meteor npm rebuild and

I don’t know why, but it made me jump (package.json) from "bcrypt": "^0.8.7" to "bcrypt": "^1.0.3"

After a new push, everything was back to normal, the build passed fine:

bcrypt@1.0.3 install /tmp/build_59afe435de8887940680bdd38395a5fa/Ontokrat-Bob-59d08d1c538ca9828e67454fe21874beaa3d6b98/.meteor/heroku_build/app/programs/server/npm/node_modules/bcrypt
node-pre-gyp install --fallback-to-build
[bcrypt] Success: “/tmp/build_59afe435de8887940680bdd38395a5fa/Ontokrat-Bob-59d08d1c538ca9828e67454fe21874beaa3d6b98/.meteor/heroku_build/app/programs/server/npm/node_modules/bcrypt/lib/binding/bcrypt_lib.node” is installed via remote


#57

I would certainly recommend installing a newer version of bcrypt as 0.8.7 is not current (and may only be designed for older Node verisons. Running:

meteor npm install bcrypt@latest --save

…might fix the problem?


#58

On MacOS 10.13.6 with the latest Xcode installed and METEOR@1.7.0.5 it tries to download the wrong version of bcrypt from github (node-v57) and then proceeds to try to build it and fails. How can I make it so it downloads an existing pre-built version?

jmangold at Jans-MacBook-Pro in ~/M/b                                                                                             15:19:45
 meteor npm install bcrypt@latest --save

> bcrypt@3.0.0 install /Users/jmangold/Meteor/b/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) 
.
.
.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! bcrypt@3.0.0 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the bcrypt@3.0.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.


#59

Meteor 1.7.0.5 ships with node v8.11.4 which uses API version 57

So it was trying to download the correct version of bcrypt for that version of Meteor
https://nodejs.org/en/download/releases/

The reason it couldn’t download a pre-built binary is because bcrypt didn’t build a macOS binary for bcrypt 3 on node 8
https://github.com/kelektiv/node.bcrypt.js/releases/

You can get a prebuilt of bcrypt@2.0.1 though:

meteor npm install bcrypt@2.0.1

What errors were you getting on the compilation attempt?
Have you got the required dependecies? https://github.com/nodejs/node-gyp#on-macos


#60

Thank you @coagmano, that makes sense. Here is (what I think) the most important failure when it is trying to install from source

gyp info spawn /usr/bin/python
gyp info spawn args [ '/Users/jmangold/.meteor/packages/meteor-tool/.1.7.0_5.19pr45f.7esr++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/jmangold/.meteor/packages/meteor-tool/.1.7.0_5.19pr45f.7esr++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/.bin/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/jmangold/.meteor/packages/meteor-tool/.1.7.0_5.19pr45f.7esr++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/jmangold/.node-gyp/10.4.0/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/Users/jmangold/.node-gyp/10.4.0',
gyp info spawn args   '-Dnode_gyp_dir=/Users/jmangold/.meteor/packages/meteor-tool/.1.7.0_5.19pr45f.7esr++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/Users/jmangold/.node-gyp/10.4.0/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/Users/jmangold/.meteor/packages/meteor-tool/.1.7.0_5.19pr45f.7esr++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/.bin',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp: binding.gyp not found (cwd: /Users/jmangold/.meteor/packages/meteor-tool/.1.7.0_5.19pr45f.7esr++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/.bin) while trying to load binding.gyp
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/Users/jmangold/.meteor/packages/meteor-tool/.1.7.0_5.19pr45f.7esr++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/node-gyp/lib/configure.js:336:16)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:237:12)
gyp ERR! System Darwin 17.7.0
gyp ERR! command "/usr/local/Cellar/node/10.4.0/bin/node" "/Users/jmangold/.meteor/packages/meteor-tool/.1.7.0_5.19pr45f.7esr++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/.bin/node-gyp" "configure"
gyp ERR! cwd /Users/jmangold/.meteor/packages/meteor-tool/.1.7.0_5.19pr45f.7esr++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/.bin
gyp ERR! node -v v10.4.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok 


#61

Haven’t seen that one before!

It looks like it’s using the system node (node -v v10.4.0) to build, which might be causing the issue?
Are you running npm install or meteor npm install?