Node reported an error: bcrypt failed to install.

  node.js, question

The following error was encountered during use:

➜ Hime git:(master) npm install
 
 > bcrypt@0.8.3 install /Users/yanhan/Hime/node_modules/bcrypt
 > node-gyp rebuild

Then start mongodb:

mongod --dbpath /usr/local/var/mongodb/
 
 2015-06-11T11:58:15.079 plus 0800I Journal [Initandlisten] Journaldir =/usr/local/var/mongodb/journal
 2015-06-11T11:58:15.080 plus 0800 I Journal [Initandlisten] Recover: No Journal Files Present, No Recovery Needed
 2015-06-11T11:58:15.095 plus 0800IJournal [Durability] Durability Threaded Started
 ...

Finally, you want to use node bin/run to report an error:

➜ Hime git:(master) node bin/www
 { [Error: Cannot find module '../build/Release/bson'] code: 'MODULE_NOT_FOUND' }
 Js-bson: Failed to load c plus bson extension.
 { [Error: Cannot find module '../build/Release/bson'] code: 'MODULE_NOT_FOUND' }
 Js-bson: Failed to load c plus bson extension.
 { [Error: Cannot find module '../build/Release/bson'] code: 'MODULE_NOT_FOUND' }
 Js-bson: Failed to load c plus bson extension.
 { [Error: Cannot find module '../build/Release/bson'] code: 'MODULE_NOT_FOUND' }
 Js-bson: Failed to load c plus bson extension.
 /Users/yanhan/Hime/node_modules/mongodb/lib/server.js:274
 process.nextTick(function() { throw err;  })
 ^
 Error: Could not locate the bindings file. Tried:
 → /Users/yanhan/Hime/node_modules/bcrypt/build/bcrypt_lib.node
 → /Users/yanhan/Hime/node_modules/bcrypt/build/Debug/bcrypt_lib.node
 → /Users/yanhan/Hime/node_modules/bcrypt/build/Release/bcrypt_lib.node
 → /Users/yanhan/Hime/node_modules/bcrypt/out/Debug/bcrypt_lib.node
 → /Users/yanhan/Hime/node_modules/bcrypt/Debug/bcrypt_lib.node
 → /Users/yanhan/Hime/node_modules/bcrypt/out/Release/bcrypt_lib.node
 → /Users/yanhan/Hime/node_modules/bcrypt/Release/bcrypt_lib.node
 → /Users/yanhan/Hime/node_modules/bcrypt/build/default/bcrypt_lib.node
 → /Users/yanhan/Hime/node_modules/bcrypt/compiled/0.12.4/darwin/x64/bcrypt_lib.node
 at bindings (/Users/yanhan/Hime/node_modules/bcrypt/node_modules/bindings/bindings.js:88:9)
 at Object.<anonymous> (/Users/yanhan/Hime/node_modules/bcrypt/bcrypt.js:3:35)
 at Module._compile (module.js:460:26)
 at Object.Module._extensions..js (module.js:478:10)
 at Module.load (module.js:355:32)
 at Function.Module._load (module.js:310:12)
 at Module.require (module.js:365:17)
 at require (module.js:384:17)
 at Object.<anonymous> (/Users/yanhan/Hime/common/util.js:1:76)
 at Module._compile (module.js:460:26)

After searching, I referred to the answer on stack overflow.

http://stackoverflow.com/questions/21656420/failed-to-load-c-bson-exte …

But still not. Several methods have been tried (including changing the bson path in index.js)

At present, it is uncertain whether it is the bson problem. Or mogondb? Or?

Thank you for your help.

=================================

Try again with cnpm with the following error:

➜ Hime git:(master) rimraf node_modules/
➜ Hime git:(master) cnpm cache clean
➜ Hime git:(master) cnpm install

> bcrypt@0.8.3 install /Users/yanhan/Hime/node_modules/bcrypt
> node-gyp rebuild

gyp: /Users/yanhan/.node-gyp/0.12.4/common.gypi not found (cwd: /Users/yanhan/Hime/node_modules/bcrypt) while reading includes of binding.gyp 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 (/usr/local/lib/node_modules/cnpm/node_modules/pangyp/lib/configure.js:345:16)
gyp ERR! stack     at ChildProcess.emit (events.js:110:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:1074:12)
gyp ERR! System Darwin 14.3.0
gyp ERR! command "node" "/usr/local/lib/node_modules/cnpm/node_modules/pangyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/yanhan/Hime/node_modules/bcrypt
gyp ERR! node -v v0.12.4
gyp ERR! pangyp -v v2.1.0
gyp ERR! not ok

> kerberos@0.0.12 install /Users/yanhan/Hime/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos
> (node-gyp rebuild 2> builderror.log) || (exit 0)

npm WARN installMany nopt was bundled with node-pre-gyp@0.6.4, but bundled package wasn't found in unpacked tree
npm WARN installMany npmlog was bundled with node-pre-gyp@0.6.4, but bundled package wasn't found in unpacked tree
npm WARN installMany request was bundled with node-pre-gyp@0.6.4, but bundled package wasn't found in unpacked tree
npm WARN installMany semver was bundled with node-pre-gyp@0.6.4, but bundled package wasn't found in unpacked tree
npm WARN installMany tar was bundled with node-pre-gyp@0.6.4, but bundled package wasn't found in unpacked tree
npm WARN installMany tar-pack was bundled with node-pre-gyp@0.6.4, but bundled package wasn't found in unpacked tree
npm WARN installMany mkdirp was bundled with node-pre-gyp@0.6.4, but bundled package wasn't found in unpacked tree
npm WARN installMany rc was bundled with node-pre-gyp@0.6.4, but bundled package wasn't found in unpacked tree
npm WARN installMany rimraf was bundled with node-pre-gyp@0.6.4, but bundled package wasn't found in unpacked tree
/
> bson-ext@0.1.7 install /Users/yanhan/Hime/node_modules/mongodb/node_modules/mongodb-core/node_modules/bson/node_modules/bson-ext
> (node-pre-gyp install --fallback-to-build) || (node-gyp rebuild 2> builderror.log) || (exit 0)

gyp: /Users/yanhan/.node-gyp/0.12.4/common.gypi not found (cwd: /Users/yanhan/Hime/node_modules/mongodb/node_modules/mongodb-core/node_modules/bson/node_modules/bson-ext) while reading includes of binding.gyp 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 (/usr/local/lib/node_modules/cnpm/node_modules/pangyp/lib/configure.js:345:16)
gyp ERR! stack     at ChildProcess.emit (events.js:110:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:1074:12)
gyp ERR! System Darwin 14.3.0
gyp ERR! command "/usr/local/Cellar/node/0.12.4/bin/node" "/usr/local/lib/node_modules/cnpm/node_modules/pangyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/Users/yanhan/Hime/node_modules/mongodb/node_modules/mongodb-core/node_modules/bson/node_modules/bson-ext/build/Release/bson.node" "--module_name=bson" "--module_path=/Users/yanhan/Hime/node_modules/mongodb/node_modules/mongodb-core/node_modules/bson/node_modules/bson-ext/build/Release"
gyp ERR! cwd /Users/yanhan/Hime/node_modules/mongodb/node_modules/mongodb-core/node_modules/bson/node_modules/bson-ext
gyp ERR! node -v v0.12.4
gyp ERR! pangyp -v v2.1.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/Cellar/node/0.12.4/bin/node /usr/local/lib/node_modules/cnpm/node_modules/pangyp/bin/node-gyp.js configure --fallback-to-build --module=/Users/yanhan/Hime/node_modules/mongodb/node_modules/mongodb-core/node_modules/bson/node_modules/bson-ext/build/Release/bson.node --module_name=bson --module_path=/Users/yanhan/Hime/node_modules/mongodb/node_modules/mongodb-core/node_modules/bson/node_modules/bson-ext/build/Release' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/Users/yanhan/Hime/node_modules/mongodb/node_modules/mongodb-core/node_modules/bson/node_modules/bson-ext/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:110:17)
node-pre-gyp ERR! stack     at maybeClose (child_process.js:1015:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
node-pre-gyp ERR! System Darwin 14.3.0
node-pre-gyp ERR! command "node" "/Users/yanhan/Hime/node_modules/mongodb/node_modules/mongodb-core/node_modules/bson/node_modules/bson-ext/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /Users/yanhan/Hime/node_modules/mongodb/node_modules/mongodb-core/node_modules/bson/node_modules/bson-ext
node-pre-gyp ERR! node -v v0.12.4
node-pre-gyp ERR! node-pre-gyp -v v0.6.4
node-pre-gyp ERR! not ok
Failed to execute '/usr/local/Cellar/node/0.12.4/bin/node /usr/local/lib/node_modules/cnpm/node_modules/pangyp/bin/node-gyp.js configure --fallback-to-build --module=/Users/yanhan/Hime/node_modules/mongodb/node_modules/mongodb-core/node_modules/bson/node_modules/bson-ext/build/Release/bson.node --module_name=bson --module_path=/Users/yanhan/Hime/node_modules/mongodb/node_modules/mongodb-core/node_modules/bson/node_modules/bson-ext/build/Release' (1)
npm ERR! Darwin 14.3.0
npm ERR! argv "node" "/usr/local/lib/node_modules/cnpm/node_modules/.bin/npm" "--userconfig=/Users/yanhan/.cnpmrc" "--disturl=https://npm.taobao.org/mirrors/node" "--cache=/Users/yanhan/.cnpm" "--registry=https://registry.npm.taobao.org" "--node-gyp=/usr/local/lib/node_modules/cnpm/node_modules/pangyp/bin/node-gyp.js" "install"
npm ERR! node v0.12.4
npm ERR! npm  v2.7.6
npm ERR! code ELIFECYCLE

npm ERR! bcrypt@0.8.3 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bcrypt@0.8.3 install script 'node-gyp rebuild'.
npm ERR! 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-gyp rebuild
npm ERR! 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!     /Users/yanhan/Hime/npm-debug.log