节点预石膏错误!和gyp ERR!处理?

时间:2019-06-03 14:59:43

标签: node.js node-gyp gyp

我正在尝试使用yarn构建一个大项目,并且以node-gyp ERR形式出现很多错误!和gyp ERR! 错误如下:

22 warnings and 11 errors generated.
make: *** [Release/obj.target/fse/fsevents.o] Error 1
22 warnings and 11 errors generated.
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit(/usr/local/Cellar/node/12.3.1/libexec/lib/node_modules/npm/node_modules/no de-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:200:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Darwin 18.6.0
gyp ERR! command \"/usr/local/Cellar/node/12.3.1/bin/node\" \"/usr/local/Cellar/node/12.3.1/libexec/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js\" \"build\" \"--fallback-to-build\" \"--module=/Users/x/Desktop/p-w/p-r/node_modules/fsevents/lib/binding/Release/node-v72-darwin-x64/fse.node\" \"--module_name=fse\" \"--module_path=/Users/x/Desktop/p-w/p-r/node_modules/fsevents/lib/binding/Release/node-v72-darwin-x64\" \"--napi_version=4\" \"--node_abi_napi=napi\"
gyp ERR! cwd /Users/x/Desktop/p-w/p-r/node_modules/fsevents
gyp ERR! node -v v12.3.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute 'node-gyp build --fallback-to-build --module=/Users/x/Desktop/p-w/p-r/node_modules/fsevents/lib/binding/Release/node-v72-darwin-x64/fse.node --module_name=fse --module_path=/Users/x/Desktop/p-w/p-r/node_modules/fsevents/lib/binding/Release/node-v72-darwin-x64 --napi_version=4 --node_abi_napi=napi' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/Users/x/Desktop/p-w/p-r/node_modules/fsevents/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:200:13)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:1021:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
node-pre-gyp ERR! System Darwin 18.6.0
node-pre-gyp ERR! command \"/usr/local/Cellar/node/12.3.1/bin/node\" \"/Users/x/Desktop/p-w/p-r/node_modules/fsevents/node_modules/node-pre-gyp/bin/node-pre-gyp\" \"install\" \"--fallback-to-build\"
node-pre-gyp ERR! cwd /Users/x/Desktop/p-w/p-r/node_modules/fsevents
node-pre-gyp ERR! node -v v12.3.1
node-pre-gyp ERR! node-pre-gyp -v v0.10.3
node-pre-gyp ERR! not ok 
Failed to execute 'node-gyp build --fallback-to-build --module=/Users/x/Desktop/p-w/p-r/node_modules/fsevents/lib/binding/Release/node-v72-darwin-x64/fse.node --module_name=fse --module_path=/Users/x/Desktop/p-w/p-r/node_modules/fsevents/lib/binding/Release/node-v72-darwin-x64 --napi_version=4 --node_abi_napi=napi' (1)
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/Cellar/node/12.3.1/libexec/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:200:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Darwin 18.6.0
gyp ERR! command \"/usr/local/Cellar/node/12.3.1/bin/node\" \"/usr/local/Cellar/node/12.3.1/libexec/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js\" \"build\" \"--fallback-to-build\" \"--module=/Users/x/Desktop/p-w/p-r/node_modules/fsevents/lib/binding/Release/node-v72-darwin-x64/fse.node\" \"--module_name=fse\" \"--module_path=/Users/x/Desktop/p-w/p-r/node_modules/fsevents/lib/binding/Release/node-v72-darwin-x64\" \"--napi_version=4\" \"--node_abi_napi=napi\"
gyp ERR! cwd /Users/x/Desktop/p-w/p-r/node_modules/fsevents
gyp ERR! node -v v12.3.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok"

这可能是什么原因?

2 个答案:

答案 0 :(得分:0)

可能存在一些依赖性问题,请尝试

npm rebuild

如果未成功,请尝试删除package-lock.json,node_modules,然后重新安装

rm -rf node_modules && rm package-lock.json && npm install

答案 1 :(得分:-1)

同一期 删除package-lock.jsonnode_modules。运行

npm install