node-gyp: node-gyp rebuild Fails on Mac OS X 10.9.4

Terminal output


hiredis@0.1.17
node@v0.11.13
node-gyp@v1.0.1
npm@1.4.9

which libtool
/usr/bin/libtool


$ npm install -g hiredis
npm http GET https://registry.npmjs.org/hiredis
npm http 304 https://registry.npmjs.org/hiredis
npm http GET https://registry.npmjs.org/nan
npm http GET https://registry.npmjs.org/bindings
npm http 304 https://registry.npmjs.org/bindings
npm http 304 https://registry.npmjs.org/nan

> hiredis@0.1.17 install /usr/local/lib/node_modules/hiredis
> node-gyp rebuild

  CC(target) Release/obj.target/hiredis/deps/hiredis/hiredis.o
  CC(target) Release/obj.target/hiredis/deps/hiredis/net.o
  CC(target) Release/obj.target/hiredis/deps/hiredis/sds.o
  CC(target) Release/obj.target/hiredis/deps/hiredis/async.o
  LIBTOOL-STATIC Release/hiredis.a
libtool: unrecognized option `-static'
libtool: Try `libtool --help' for more information.
make: *** [Release/hiredis.a] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:110:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:1046:12)
gyp ERR! System Darwin 13.3.0
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/hiredis
gyp ERR! node -v v0.11.13
gyp ERR! node-gyp -v v0.13.0
gyp ERR! not ok
npm ERR! hiredis@0.1.17 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the hiredis@0.1.17 install script.
npm ERR! This is most likely a problem with the hiredis 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 hiredis
npm ERR! There is likely additional logging output above.

npm ERR! System Darwin 13.3.0
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "hiredis"
npm ERR! cwd /Users/ashokafinley
npm ERR! node -v v0.11.13
npm ERR! npm -v 1.4.9
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     /Users/ashokafinley/npm-debug.log
npm ERR! not ok code 0

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Comments: 65 (3 by maintainers)

Most upvoted comments

this binding.gyp file is the biggest pain in the ass

For anyone who still runs into this issue, here’s the fix: npm config set python /usr/bin/python.

I finally figured out what the actual problem is. npm is being pointed to the userland python (typically installed by brew … /usr/local/bin/python) not the system level python (/usr/bin/python). I just didn’t know that there was a system level python.

xcode-select --install
npm install -g npm@latest

worked for me

on darwin (MacOS) xcode-select --install did the job

Update, I solved it. This was happening when npm was trying to install bcrypt.

For some reason, within the project, npm install bcrypt was failing, but npm install -g bcrypt worked. So running within the directory of the project npm link bcrypt did the trick.

This is still weird. Not sure what’s wrong with my setup.

If you are using Homebrew, this link was very usefull for me: http://flummox-engineering.blogspot.com.au/2014/04/libtool-unrecognized-option-static.html

brew unlink libtool

They was a conflict between usr/bin/libtool (Xcode) and usr/local/bin/libtool (HomeBrew)

@joemanfoo and installing python works? because I have python but that doesn’t make this rebuild correctly.

when i install node-gyp manually npm install node-gyp it installs just fine. so it leads me to believe the weak module which has node-gyp as dependency just uses it wrong. i made a ticket over there as well.

https://github.com/TooTallNate/node-weak/issues/30

I just encountered this issue and realized that previously I had used pyenv and changed my python version. Since it seems to be involved in the compiling of bcrypt (news to me), I had to change my python version back to 2.7.10 to make it work:

pyenv global 2.7.10

This helped me solve the problem of node-gyp version - https://github.com/nodejs/node-gyp/wiki/Updating-npm's-bundled-node-gyp

@xdamman cheers saved my night.

Same issue with:

MacOSX 10.11.6 (also tried with MacOSX 10.11.5)
node v.6.3.1 (also tried with node v6.2.2)
npm 3.10.3
python 2.7.10

I did sudo xcodebuild -license

I did xcode-select --install

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

Still doesn’t work. Then I tried brew unlink libtool

Error: No such keg: /usr/local/Cellar/libtool

Still doesn’t work. Then I tried brew install pkg-config

Warning: pkg-config-0.29.1_1 already installed

Still no luck. Running out of ideas.

npm install -g node-gyp works like a charm. but npm install still fails at:

> bcrypt@0.8.5 install /Users/xdamman/github/opencollective/api/node_modules/bcrypt
> node-gyp rebuild

My only luck was to downgrade node to v5.12.0.

Ran all the suggested commands above and still didn’t work. Restarted my computer and it started working magically. So if all fails, try restarting! 👍

I have darwin and node 5.0 installed sudo xcodebuild -license fix my issue. Thanks @qmmr

You may want to look at what package you are trying to install. For instance, the firebase@latest package fails with node-gyp because it has an outdated grpc dependency. I was trying to do just that and ended up having to downgrade my node version to 10.13.0 in order to avoid the node-gyp build errors when installing firebase.

I’m on El Capitan (10.11) and @veacks suggestion of brew unlink libtool did the trick for me.

MacOS Mojave v10.14 here, I solved it by setting some environment flags:

env LDFLAGS="-mmacosx-version-min=10.9" CXXFLAGS="-mmacosx-version-min=10.9" npm install

Install node-gyp globally worked for me.

$ npm i -g node-gyp

None of the suggestions in this issue thread worked for me except downgrading node to 6.10.0 LTS

@xdamman thank you. Worked like charm after trying tons of suggestions.

Upgrading node 5 to 8 worked for me. nvm install 8

Changing my python version to 2.7 via pyenv fixed the issue with fsevents for me! Thanks for the comment about that I was pulling my hair out over this!

xcode-select --install
npm install -g npm@latest

worked for me

npm install -g npm@latest Worked for me

i had solved this by downgrading the node and npm versions

Before versions:

node - v10.14.2 npm - 6.5.0

i had downgraded to below versions

After versions :

node - v8.11.3 npm - 5.6.0

this issue will be resolved,please try if any one still facing the issue

@refack the .pyenv directory is typically at the user’s home folder at $HOME/.pyenv but the path can also be determined by evaluating $(pyenv root)/ or by looking at the PYENV_ROOT environment variable.

Just solved same problem.

In my case, Mac OS X automatic updates downloaded and installed a new version of XCode.

As you may know, you have to accept the license agreement in order to use both XCode and its command line tools.

libtool is one of these command line tools. libtool is used by node-gyp.

I run libtool and accepted license agreement via terminal.

Everything worked soon after.