gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/Users/wlk_yodinfo/Documents/front_projects/diy-cli/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/wlk_yodinfo/Documents/front_projects/diy-cli/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64/fse.node" "--module_name=fse" "--module_path=/Users/wlk_yodinfo/Documents/front_projects/diy-cli/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64" "--napi_version=4" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v64"
gyp ERR! cwd /Users/wlk_yodinfo/Documents/front_projects/diy-cli/node_modules/fsevents
gyp ERR! node -v v10.16.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
分析原因:
包下载的安全问题,猜测npm下载默认是拉取安全的包到node_modules,因此如果被判定不够安全,不会被拉取下来,并且会抛出一个错误记录
解决办法:
sudo npm i --unsafe-perm
如果不行,可以尝试一下办法:
sudo rm -rf ~/.node-gyp
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
sudo npm i --unsafe-perm
版权声明:本文为hzxOnlineOk原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。