Search code examples
node.jsmacosnpmnode-gyp

node-gyp rebuild fails when installing webpack and other packages on OSX


I'm on OS 10.10.13, with node v0.12.4 and npm v2.10.1. Whenever I run the following command to install webpack npm install webpack --save-dev --save-exact, I get the following error when node-gyp rebuild is called:

> fsevents@0.3.6 install /Volumes/Macintosh HD/Users/ev_blurbs/Sites/products/react-week/new-app/node_modules/webpack/node_modules/watchpack/node_modules/chokidar/node_modules/fsevents
> node-gyp rebuild

  SOLINK_MODULE(target) Release/.node
  SOLINK_MODULE(target) Release/.node: Finished
  CXX(target) Release/obj.target/fse/fsevents.o
clang: error: no such file or directory: 'HD/Users/ev_blurbs/.node-gyp/0.12.4/src'
clang: error: no such file or directory: 'HD/Users/ev_blurbs/.node-gyp/0.12.4/deps/uv/include'
clang: error: no such file or directory: 'HD/Users/ev_blurbs/.node-gyp/0.12.4/deps/v8/include'
make: *** [Release/obj.target/fse/fsevents.o] 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:269:23)
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 14.3.0
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Volumes/Macintosh HD/Users/ev_blurbs/Sites/products/react-week/new-app/node_modules/webpack/node_modules/watchpack/node_modules/chokidar/node_modules/fsevents
gyp ERR! node -v v0.12.4
gyp ERR! node-gyp -v v1.0.3
gyp ERR! not ok
npm WARN optional dep failed, continuing fsevents@0.3.6

The no such file or directory errors appear to be looking in the wrong place. For example it is checking for:

HD/Users/ev_blurbs/.node-gyp/0.12.4/src

That file is instead located at:

/Volumes/Macintosh HD/Users/ev_blurbs/.node-gyp/0.12.4/src

I used homebrew to install node, and recently updated node, npm, and homebrew. Let me know if you notice any potential problems. Thanks for your help in advance!

Cheers, Evan


Solution

  • This is a known issue with gyp/node-gyp that affects all platforms. You might want to add your two cents to that issue.