node-gyp rebuild Fails on Mac OS X 10.9.4

Created on 12 Aug 2014  ·  64Comments  ·  Source: nodejs/node-gyp

Terminal output


[email protected]
[email protected]
[email protected]
[email protected]

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

> [email protected] 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! [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 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

macOS

Most helpful comment

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

All 64 comments

I get similar issue on Ubuntu 12.04.5 LTS. when I try to install nodetime. Some suggest that python needs to be installed (which I have) so just posting this to hope that it helps you in case you do not have python installed.

@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

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

@jfroffice, xcode-select --install did not works for me, on Yosemite.

Downgrading node.js to the 0.10.x branch seems to fix the thing.

@kamisama, I am also on node.js 0.10.x.

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

Any solution for node 0.11.x yet? Getting the same error on Mac OSX 10.10.
Works with node 0.10.x though.

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)

Ditto what @Globegitter said: I've given up trying to get around this failed build on Mac OSX and Node v0.12 (I'm trying to npm install canvas which requires node-gyp) but once I removed Node and installed version 0.10.9 instead (directly from nodejs.org, rather than via Homebrew), canvas and node-gyp install fine.

My issue sounds more similar to https://github.com/Homebrew/homebrew/issues/14123 in that the error message when rebuilding node-gyp was Package 'xcb-shm', required by 'cairo', not found, but the only solution that's worked for me so far was the Node version downgrade mentioned above.

@Arkantas Many Thanks for the link, It really helped me out :)

Same problem here. But I found my libtool is actully /opt/chefdk/embedded/bin/libtool, so sudo rm -rf /opt/chefdk can solve my problem.

gyp: binding.gyp not found ... big pain

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

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.

@adriano-di-giovanni, I've tried running libtool to accept the agreement and got this output -

 error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: no files specified
 Usage: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -static [-] file [...] [-filelist listfile[,dirname]] [-arch_only arch] [-sacLT] [-no_warning_for_no_symbols]
 Usage: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -dynamic [-] file [...] [-filelist listfile[,dirname]] [-arch_only arch] [-o output] [-install_name name] [-compatibility_version #] [-current_version #] [-seg1addr 0x#] [-segs_read_only_addr 0x#] [-segs_read_write_addr 0x#] [-seg_addr_table <filename>] [-seg_addr_table_filename <file_system_path>] [-all_load] [-noall_load]

Could you help me solve this please?

Running libtool is just a shortcut to accept license agreement. I don't know why it fails on your machine but you can always open XCode and accept the license agreement.

Try and please, let me know 😉

Inviato da iPhone

Il giorno 02 nov 2015, alle ore 15:44, Yaron Idan [email protected] ha scritto:

@adriano-di-giovanni, I've tried running libtool to accept the agreement and got this output -
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: no files specified
Usage: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -static [-] file [...] [-filelist listfile[,dirname]] [-arch_only arch] [-sacLT] [-no_warning_for_no_symbols]
Usage: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -dynamic [-] file [...] [-filelist listfile[,dirname]] [-arch_only arch] [-o output] [-install_name name] [-compatibility_version #] [-current_version #] [-seg1addr 0x#] [-segs_read_only_addr 0x#] [-segs_read_write_addr 0x#] [-seg_addr_table ] [-seg_addr_table_filename ] [-all_load] [-noall_load]

Could you help me solve this please?


Reply to this email directly or view it on GitHub.

True enough, XCode license wasn't my problem, and the license agreement was already accepted (as I found out through opening XCode like you advised)
The problem ended up being node not upgraded to suit El-Capitan, after I upgraded it everything went pretty smooth...

Thank you for the support!

You're welcome 😉

Inviato da iPhone

Il giorno 03 nov 2015, alle ore 09:31, Yaron Idan [email protected] ha scritto:

True enough, XCode license wasn't my problem, and the license agreement was already accepted (as I found out through opening XCode like you advised)
The problem ended up being node not upgraded to suit El-Capitan, after I upgraded it everything went pretty smooth...

Thank you for the support!


Reply to this email directly or view it on GitHub.

I am on Yosemite (10.10.5) tried with Node 5.0.0 then with 0.10.x direct from Node.js website and have this issue and nothing listed above has fixed the problem.

I've had a similar issue with node-gyp and node v5.0.0 but it turned out to be the xcode that was causing issues. After accepting the license via sudo xcodebuild -license it was a smooth ride.

@yaron-idan what did you mean you upgraded everything? What'd you upgrade?

@mmahalwy My node version was <5.0.0, I don't remember the exact number. After I've upgraded node to 5.0.0 and npm to 3.3.9 the problem was solved.

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

worked for me

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

Same problem as @topherhunt while trying to install canvas.
brew install pkg-config solved the problem for me.

this is a useful link... http://flummox-engineering.blogspot.com/2014/04/libtool-unrecognized-option-static.html

basically, if you're using GNU Libtool, you need to unlink it... I had to do this manually because I was using it, but not because of brew...

@adriano-di-giovanni suggestion works for me. Thanks for your post!

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 was having this problem on OSX v10.11.5 (15F34) running node v6.2.1 and sudo xcodebuild -license seems to have resolved it. Weird.

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:

> [email protected] install /Users/xdamman/github/opencollective/api/node_modules/bcrypt
> node-gyp rebuild

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

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.

Update 2: the reason why it was working with npm -g is because it was installing bcrypt 0.8.7, whereas within the project directory, it was installing bcrypt 0.8.5. So updating the version number of bcrypt in package.json solved the issue. Mystery solved!

@xdamman cheers saved my night.

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

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

@mbutler Same here. I had lwip installing fine running node-gyp rebuild, then updated brew this morning and updated node from 7.7.2 to 7.7.3 and it broke it. After trying many things, finally uninstalled node from brew altogether and installed 6.10.0LTS from nodejs.org...

now I need to go back and discover what else has been broken by this whole process... :-/

tested in mac os x 10.11.6, using v6.10.1 and npm 4.4.4, I run npm install -g npm@latest node-gyp, and now I'm able to compile the modules

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

I use pyenv to manage my python installations, and I was unable to get node-gyp to build until I explicitly configured npm so that it used the correct python virtualenv shim, like so:
npm config set python /Users/your_username_here/.pyenv/versions/2.7.10/envs/virtual_env_name_here/bin/python

Do you know if pyenv has a local registry that node-gyp can query (or a stable path)?

@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.

It _seems_ like general installation issues (XCode license, etc.) was the issue here, as well as running on outdated versions of Node.js and node-gyp. Upgrading Node.js / node-gyp to a supported version will fix this problem, so going to close this this ticket for now since a fix has been identified.

Node v9.11.2 with npm 5.6.0 seemed working for me

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.

@mattbontrager's solution fixed it for me. I had a Python 3 at /usr/local/bin/python, and node-gyp needs Python 2 at /usr/bin/python

brew upgrade worked for me. must not have done it since OSX update

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.

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

I had this issue, not sure how it got there, but the resolution was removing an older package that we had as a dependency. 'gulp-core' which hadn't been updated in 3 years, referring to a really outdated version.

Was a bit annoying, but resolved by removing that package...

Bit of a basic issue, just thought I'd put this here to help others, if they can't figure it out...

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

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

worked for me

npm install -g npm@latest
Worked for me

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!

you need install something before installing node-gyp
references:
https://www.npmjs.com/package/node-gyp

thanks @xdamman <3

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

npm install node-gyp solves the problem for me. (MacOS)

Install node-gyp globally worked for me.

$ npm i -g node-gyp

I followed the instructions posted here: https://github.com/nodejs/node-gyp/issues/569
and got it working.

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

It needs Python 2.
If you use pyenv, to install Python 2 you first need to uninstall openssl

brew uninstall --ignore-dependencies [email protected]

Then

pyenv install 2.7.9

And you will be all set

npm install node-gyp

You may want to install openssl again:

brew install [email protected]

Nothing needs Python 2 anymore. Python 2 died on 1/1/2020.

I know it is dead. That set of commands its what worked for me anyway.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jplatte picture jplatte  ·  3Comments

andrewaustin picture andrewaustin  ·  3Comments

jhermsmeier picture jhermsmeier  ·  3Comments

jlchereau picture jlchereau  ·  3Comments

alexeyvo picture alexeyvo  ·  3Comments