在OSX上安装webpack和其他软件包时node-gyp rebuild失败

我在OS 10.10.13,节点v0.12.4和npm v2.10.1。 每当我运行以下命令安装webpack npm install webpack --save-dev --save-exact ,当node-gyp rebuild被调用时,我得到以下错误:

 > 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 

no such file or directory错误似乎是在错误的地方看。 例如它正在检查:

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

该文件位于:

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

我用自制软件来安装节点,最近更新了节点npm和homebrew。 如果您发现任何潜在的问题,请告诉我。 感谢您的帮助提前!

干杯,埃文

这是影响所有平台的gyp / node-gyp的已知问题 。 你可能想要添加你的两美分这个问题。

node-gyp在Windows上是一种痛苦,看起来好像很快就会消失。 经过漫长的斗争之后,我向你们提出的build议 – 如果你可以select在Mac或Linux机器上开发,那就去做吧。 但是,如果你绝对需要在Windows上开发,那就花一些时间来设置一个无用的工作stream程。 或者如果你要完成这个任务 – 去Docker。 正是由于这个原因,我select了我的Windows系统。 以避免node-gyp恶梦… Vagrant基本上是一种自动configuration运行Linux的虚拟机的方式,并且尽可能地将环境运行到生产configuration。 其function之一是在主机操作系统之间同步文件夹 – 在这种情况下,Windows和Linux VM。 这个给你的是能够使用你最喜欢的编辑器和Windows上的其他东西作为开发机器,而你的代码和npm安装实际上运行在Linux VM上。 从他们开始 – 你可以使用node-gyp。 希望这可以帮助。