已解决:gyp ERR! configure error gyp ERR! stack Error: EACCES: permission denied......

运行sudo npm install -g [email protected] 安装指定版本的webpack出现如下错误:

gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir ‘/Users/mac-pro/.nvm/versions/node/v10.16.0/lib/node_modules/webpack/node_modules/fsevents/build’
gyp ERR! System Darwin 19.3.0
gyp ERR! command “/Users/mac-pro/.nvm/versions/node/v10.16.0/bin/node” “/Users/mac-pro/.nvm/versions/node/v10.16.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js” “rebuild”
gyp ERR! cwd /Users/mac-pro/.nvm/versions/node/v10.16.0/lib/node_modules/webpack/node_modules/fsevents
gyp ERR! node -v v10.16.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/webpack/node_modules/fsevents):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] install: node-gyp rebuild
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1…

解决办法: sudo npm install --unsafe-perm [email protected]

官网解释:
unsafe-perm§
Default: false if running as root, true otherwise
Type: Boolean
Set to true to suppress the UID/GID switching when running package scripts. If set explicitly to false, then installing as a non-root user will fail.

发布了1 篇原创文章 · 获赞 0 · 访问量 24

猜你喜欢

转载自blog.csdn.net/Reina_Wang/article/details/104370873