![sudo npm install 命令抛出错误](https://linux22.com/image/1587544/sudo%20npm%20install%20%E5%91%BD%E4%BB%A4%E6%8A%9B%E5%87%BA%E9%94%99%E8%AF%AF.png)
sudo npm install 总是抛出一堆错误。
- 我已经用或不用 sudo 完成了此操作,
- 我在全球和本地都尝试过,
- 我彻底卸载并安装了当前版本(11.13.0)和 LTS(10.15.3),
- 我清理完现金后尝试过,
- 我尝试输入--unsafe-perm,
- 我尝试授予所有附件的权限,并递归地,
- 我尝试使用 Sierra 而不是 Mojave。
我不记得我还尝试了什么,但我几乎尝试了在网上能找到的所有方法。
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/Users/juneau/Documents/learning/vue/test/node_modules/fsevents/build'
gyp ERR! System Darwin 18.5.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/juneau/Documents/learning/vue/test/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64/fse.node" "--module_name=fse" "--module_path=/Users/juneau/Documents/learning/vue/test/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64" "--napi_version=3" "--node_abi_napi=napi"
gyp ERR! cwd /Users/juneau/Documents/learning/vue/test/node_modules/fsevents
gyp ERR! node -v v10.15.3
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/juneau/Documents/learning/vue/test/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64/fse.node --module_name=fse --module_path=/Users/juneau/Documents/learning/vue/test/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64 --napi_version=3 --node_abi_napi=napi' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/Users/juneau/Documents/learning/vue/test/node_modules/fsevents/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:189:13)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:970:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
node-pre-gyp ERR! System Darwin 18.5.0
node-pre-gyp ERR! command "/usr/local/bin/node" "/Users/juneau/Documents/learning/vue/test/node_modules/fsevents/node_modules/node-pre-gyp/bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /Users/juneau/Documents/learning/vue/test/node_modules/fsevents
node-pre-gyp ERR! node -v v10.15.3
node-pre-gyp ERR! node-pre-gyp -v v0.10.3
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/juneau/Documents/learning/vue/test/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64/fse.node --module_name=fse --module_path=/Users/juneau/Documents/learning/vue/test/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64 --napi_version=3 --node_abi_napi=napi' (1)
我确实希望至少在没有高漏洞错误的情况下安装它。