【问题标题】:node-gyp rebuild fails when installing webpack and other packages on OSX在 OSX 上安装 webpack 和其他软件包时 node-gyp 重建失败
【发布时间】:2015-08-07 09:03:32
【问题描述】:

我使用的是 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

我使用 homebrew 安装 node,最近更新了 node、npm 和 homebrew。如果您发现任何潜在问题,请告诉我。提前感谢您的帮助!

干杯, 埃文

【问题讨论】:

    标签: node.js macos npm node-gyp


    【解决方案1】:

    node-gyp 对 Windows 来说是一种痛苦,而且看起来它不会很快消失。 经过长时间的奋斗,我给你的建议 - 如果你可以选择在 Mac 或 Linux 机器上开发,那就去吧。然而——如果你绝对要在 Windows 上开发——花一些时间来建立一个流浪的工作流程。或者,如果您能胜任这项任务 - 使用 Docker。正是出于这个原因,我为我的 Windows 设置选择了 vagrant。为了避免 node-gyp 的噩梦...... Vagrant 基本上是一种自动配置运行 Linux 的 VM 并运行尽可能接近生产配置的环境的方法。 它的功能之一是在托管操作系统(本例中为 Windows)和 Linux VM 之间同步文件夹。这使您能够使用您最喜欢的编辑器和 Windows 上的任何其他东西作为开发机器,而您的代码和 npm 安装实际上运行在 Linux VM 上。从他们开始 - 你可以使用 node-gyp。 希望这会有所帮助。

    【讨论】:

      【解决方案2】:

      这是一个known issuegyp/node-gyp,影响所有平台。您可能想在该问题上增加两分钱。

      【讨论】:

      • 谢谢!很高兴我不是唯一一个经历它的人。
      • 问题似乎仍然存在,尚未修复。
      猜你喜欢
      • 1970-01-01
      • 2021-09-08
      • 2023-04-09
      • 1970-01-01
      • 1970-01-01
      • 2018-05-19
      • 2016-10-29
      • 2016-02-01
      • 2015-12-23
      相关资源
      最近更新 更多