gpt4 book ai didi

node.js - 在 OSX 上安装 webpack 和其他包时,node-gyp 重建失败

转载 作者:太空宇宙 更新时间:2023-11-03 23:37:23 27 4
gpt4 key购买 nike

我使用的是操作系统 10.10.13, Node 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

没有这样的文件或目录错误似乎是在错误的位置查找。例如,它正在检查:

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

关于node.js - 在 OSX 上安装 webpack 和其他包时,node-gyp 重建失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30445844/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com