It's been a long time to write a blog on some tech issue. This is related to setup a NodeJS project I almost spend 2-3 hours to fix some f**king issue with
`gyp` while ruining
npm install.
Error:
gyp: binding.gyp not found (cwd: /Users/anilyadav/Documents/ahok/base12) 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/anilyadav/.nvm/versions/node/v6.9.2/lib/node_modules/node-gyp/lib/configure.js:345:16)
gyp ERR! stack at emitTwo (events.js:106:13)
gyp ERR! stack at ChildProcess.emit (events.js:191:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Darwin 18.2.0
gyp ERR! command "/Users/anilyadav/.nvm/versions/node/v6.9.2/bin/node" "/Users/anilyadav/.nvm/versions/node/v6.9.2/bin/node-gyp" "rebuild"
gyp ERR! cwd /Users/anilyadav/Documents/ahok/base12
gyp ERR! node -v v6.9.2
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
gyp: No Xcode or CLT version detected!
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/Users/anilyadav/.nvm/versions/node/v6.9.2/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:308:16)
gyp ERR! stack at emitTwo (events.js:106:13)
gyp ERR! stack at ChildProcess.emit (events.js:191:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Darwin 18.2.0
gyp ERR! command "/Users/anilyadav/.nvm/versions/node/v6.9.2/bin/node" "/Users/anilyadav/.nvm/versions/node/v6.9.2/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/anilyadav/Documents/ahok/base12/node_modules/bcrypt
gyp ERR! node -v v6.9.2
gyp ERR! node-gyp -v v3.5.0
gyp ERR! not ok
npm WARN b12prj@0.0.3 No repository field.
npm WARN b12prj@0.0.3 No license field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! bcrypt@0.8.5 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bcrypt@0.8.5 install script 'node-gyp rebuild'.
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-gyp rebuild
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! A complete log of this run can be found in:
npm ERR! /Users/anilyadav/.npm/_logs/2019-03-03T06_59_17_870Z-debug.log
Anils-MacBook-Pro:base12 anilyadav$ node-gyp rebuild
So finally found that this is something related to bcrypt version so after runing the below command it's working fine.
Solution:
$ sudo npm install --save bcrypt-nodejs && sudo npm uninstall --save bcrypt
Hope It will help to save your time
Sorry for my bad english. ;)