node-gyp: node-gyp rebuild Fail on osx with Xcode V 7.2.1

I have a problem with node-gyp rebuild Now I’m using xcode Version 7.2.1 (7C1002) and when I install the library like libxmljs@0.14.3 I have this error

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 15.3.0
gyp ERR! command "node" "/Users/bob/.nvm/versions/node/v0.12.6/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd my-path/node_modules/gulp-xml-editor/node_modules/libxmljs
gyp ERR! node -v v0.12.6
gyp ERR! node-gyp -v v2.0.1
gyp ERR! not ok
npm ERR! Darwin 15.3.0
npm ERR! argv "/Users/bob/.nvm/versions/node/v0.12.6/bin/node" "/Users/bob/.nvm/versions/node/v0.12.6/bin/npm" "install"
npm ERR! node v0.12.6
npm ERR! npm  v2.11.2
npm ERR! code ELIFECYCLE

npm ERR! libxmljs@0.14.3 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the libxmljs@0.14.3 install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the libxmljs 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 libxmljs
npm ERR! There is likely additional logging output above.

I tried with NVM with this node version

nvm 0.12.6 | nvm 0.12.7

But I have the same Problem

With command `node-gyp rebuild``

I have this output

gyp info it worked if it ends with ok
gyp info using node-gyp@3.2.1
gyp info using node@0.12.7 | darwin | x64
gyp info spawn /Applications/MAMP/Library/bin/python2
gyp info spawn args [ '/usr/local/lib/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/my-path/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/usr/local/lib/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/bob/.node-gyp/0.12.7/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/Users/bob/.node-gyp/0.12.7',
gyp info spawn args   '-Dnode_gyp_dir=/usr/local/lib/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=node.lib',
gyp info spawn args   '-Dmodule_root_dir=/my-path',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp: binding.gyp not found (cwd: my-path) 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/node-gyp/lib/configure.js:305: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 15.3.0
gyp ERR! command "node" "/usr/local/bin/node-gyp" "rebuild"
gyp ERR! cwd my-path
gyp ERR! node -v v0.12.7
gyp ERR! node-gyp -v v3.2.1
gyp ERR! not ok

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 23 (5 by maintainers)

Most upvoted comments

has anyone gotten another solution for this. I have tried removing my node_modules folder like @wnordmann said, but still had the same issue.

I’m using nvm and I solved this issue by cd ~/.nvm/versions/node/v5.5.0/lib/node_modules/npm (change v5.5.0 with your node version.) run npm install

n lts install node 4.5.0 and npm 2.15.9 worked for me