Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

trying to install bcrypt into node project + node set up issues

Tags:

node.js

npm

mean

I have seen some very similar questions but none that I have found seem to work. I am trying to npm install bcrypt but i keep getting the error below.

bycrypt is the command that I use to install bcrypt modules. I do have Xcode and installing node-gyp does not seem to make a difference

regan@the-Voyagur buddha-bar (feature/styles) $ npm install --save bcrypt
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No README data
-
> [email protected] install /Users/regan/lighthouse/buddha-bar/node_modules/bcrypt
> node-gyp rebuild

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'.

No receipt for 'com.apple.pkg.DeveloperToolsCLILeo' found at '/'.

No receipt for 'com.apple.pkg.DeveloperToolsCLI' found at '/'.

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 (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:343:16)
gyp ERR! stack     at ChildProcess.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:810:12)
gyp ERR! System Darwin 14.0.0
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/regan/lighthouse/buddha-bar/node_modules/bcrypt
gyp ERR! node -v v0.10.33
gyp ERR! node-gyp -v v1.0.1
gyp ERR! not ok

npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
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! System Darwin 14.0.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "--save" "bcrypt"
npm ERR! cwd /Users/regan/lighthouse/buddha-bar
npm ERR! node -v v0.10.33
npm ERR! npm -v 1.4.28
npm ERR! code ELIFECYCLE
npm ERR! not ok code 0
regan@the-Voyagur buddha-bar (feature/styles) $ xcode-select --print-path
/Library/Developer/CommandLineTools
like image 583
ReganPerkins Avatar asked Dec 27 '14 07:12

ReganPerkins


3 Answers

OP managed to fix this for themselves with:

sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer/

but graciously accepted my answer anyway.

Original answer below:

There are two distinct problems here. One is that your node is slightly out of date and your npm is substantially out of date.

You're using OSX, so there are a number of popular ways to manage different node versions. Here's a guide on updating node https://github.com/npm/npm/wiki/Troubleshooting#updating-node-on-osx

Then you'll want to update to the latest npm:

npm install -g npm@latest

Finally, it looks like although you have XCode installed, something is still awry. You report that this command yields

$ xcode-select --print-path /Library/Developer/CommandLineTools

On my system, which is OSX/Yosemite and can build native addon modules, I see

$ xcode-select --print-path /Applications/Xcode.app/Contents/Developer

You may need to switch your xcode path to a different directory. For starters, though, please update to the current node and npm tools and try the installation again; if it still fails, the least dangerous next thing to try is

xcode-select --install

If none of that fixes things, let me know and I'll try to help further.

like image 110
Sam Mikes Avatar answered Dec 05 '22 11:12

Sam Mikes


I was having a similar issue but with a different package.

node-gyp rebuild
No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'.
No receipt for 'com.apple.pkg.DeveloperToolsCLILeo' found at '/'.
No receipt for 'com.apple.pkg.DeveloperToolsCLI' found at '/'.
gyp: No Xcode or CLT version detected!
gyp ERR! configure error

Running macOS Catalina 10.15.2, I tried the following:

$ xcode-select --install
xcode-select: error: command line tools are already installed, 
use "Software Update" to install updates

Fixed it by doing the following:

$ [sudo] xcode-select --reset

Hope this helps someone in the future.


EDIT

If someone is still running into issues, there's a thread on GitHub that has other solutions worth trying:

  • github.com/schnerd/d3-scale-cluster/issues
like image 33
goto Avatar answered Dec 05 '22 11:12

goto


I had a simliar problem. Solving it was simple in the end. Just had to run

xcode-select --install

to install the newest tools and then

sudo xcodebuild -license

to agree to the new License terms. Afterwards bcrypt got installed without any problems.

like image 27
Torsten Barthel Avatar answered Dec 05 '22 12:12

Torsten Barthel