npm:为什么会出现“ node-pre-gyp”错误?

时间:2019-07-02 06:04:02

标签: angularjs npm npm-install node-gyp

我创建了一个新的Angular项目,并运行了npm i。 这样做之后,在我的终端上出现以下错误之前,某些安装成功完成。

我已经卸载了node-gyp,然后重新安装。

node-pre-gyp WARN Pre-built binaries not installable for fsevents@1.2.9 and node@12.5.0 (node-v72 ABI, unknown) (falling back to source compile with node-gyp) 
node-pre-gyp WARN Hit error EACCES: permission denied, mkdir '/Users/isaac/Desktop/Tutorials/Angular/ng-refresher/node_modules/fsevents/lib' 
gyp ERR! configure error 
gyp ERR! stack Error: EACCES: permission denied, mkdir '/Users/isaac/Desktop/Tutorials/Angular/ng-refresher/node_modules/fsevents/build'
gyp ERR! System Darwin 18.0.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/Users/isaac/Desktop/Tutorials/Angular/ng-refresher/node_modules/fsevents/lib/binding/Release/node-v72-darwin-x64/fse.node" "--module_name=fse" "--module_path=/Users/isaac/Desktop/Tutorials/Angular/ng-refresher/node_modules/fsevents/lib/binding/Release/node-v72-darwin-x64" "--napi_version=4" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v72"
gyp ERR! cwd /Users/isaac/Desktop/Tutorials/Angular/ng-refresher/node_modules/fsevents
gyp ERR! node -v v12.5.0
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 '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/Users/isaac/Desktop/Tutorials/Angular/ng-refresher/node_modules/fsevents/lib/binding/Release/node-v72-darwin-x64/fse.node --module_name=fse --module_path=/Users/isaac/Desktop/Tutorials/Angular/ng-refresher/node_modules/fsevents/lib/binding/Release/node-v72-darwin-x64 --napi_version=4 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/Users/isaac/Desktop/Tutorials/Angular/ng-refresher/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.0.0
node-pre-gyp ERR! command "/usr/local/bin/node" "/Users/isaac/Desktop/Tutorials/Angular/ng-refresher/node_modules/fsevents/node_modules/node-pre-gyp/bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /Users/isaac/Desktop/Tutorials/Angular/ng-refresher/node_modules/fsevents
node-pre-gyp ERR! node -v v12.5.0
node-pre-gyp ERR! node-pre-gyp -v v0.12.0
node-pre-gyp ERR! not ok 
Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/Users/isaac/Desktop/Tutorials/Angular/ng-refresher/node_modules/fsevents/lib/binding/Release/node-v72-darwin-x64/fse.node --module_name=fse --module_path=/Users/isaac/Desktop/Tutorials/Angular/ng-refresher/node_modules/fsevents/lib/binding/Release/node-v72-darwin-x64 --napi_version=4 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/fsevents):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 install: `node install`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

我希望npm i能够顺利运行,但我收到了该错误。

1 个答案:

答案 0 :(得分:1)

您的项目使用(可能间接地)使用本机模块。由于它没有用于OS和Node版本的组合的预构建模块,因此npm尝试在本地构建它。最终会因以下错误而失败:

  

gyp错误!堆栈错误:EACCES:权限被拒绝,mkdir'/ Users / isaac / Desktop / Tutorials / Angular / ng-refresher / node_modules / fsevents / build'

确保您用来运行npm install的用户具有创建该目录并重新运行npm install的权限。