问题:共事写的一个vue我的项目在我的电脑上运行npm install时报错:

gyp ERR! build error gyp ERR! stack Error: `make` failed with exit code: 2gyp ERR! stack     at ChildProcess.onExit (/Users/xxx/xxx/node_modules/node-gyp/lib/build.js:262:23)gyp ERR! stack     at ChildProcess.emit (events.js:315:20)gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)gyp ERR! System Darwin 17.7.0gyp ERR! command "/usr/local/bin/node" "/Users/xxx/xxx/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="gyp ERR! cwd /Users/xxx/xxx/node_modules/node-sassgyp ERR! node -v v12.18.0gyp ERR! node-gyp -v v3.8.0gyp ERR! not ok 

问题出在node-gyp上,然而网上的答案试了几个(
1、重新安装node-gyp、
2、从新设置权限用户sudo npm install --unsafe-perm、
3、从新设置 Xcode的门路sudo xcode-select -s /Applications/Xcode.app/Contents/Developer)都没能解决


解决方案:问题还是出在node和node-gyp版本不兼容上,能够用升降node版本来解决。我的mac零碎较老,抉择了降node版本v11.10.0