Mac上执行npm install时出现gyp ERR错误

Mac上执行npm install时出现gyp ERR错误

  • 执行npm install 出错
  • 解决办法

执行npm install 出错

gyp: No Xcode or CLT version detected!
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/Users/lianyz/projects/go-projects/gin-vue-admin/QMPlusVuePage/node_modules/node-gyp/lib/configure.js:345:16)
gyp ERR! stack     at ChildProcess.emit (events.js:314:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:276:12)
gyp ERR! System Darwin 19.5.0
gyp ERR! command "/usr/local/Cellar/node/14.7.0/bin/node" "/Users/lianyz/projects/go-projects/gin-vue-admin/QMPlusVuePage/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /Users/lianyz/projects/go-projects/gin-vue-admin/QMPlusVuePage/node_modules/node-sass
gyp ERR! node -v v14.7.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
Build failed with error code: 1
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/xxxx/.npm/_logs/2020-08-09T13_49_17_097Z-debug.log

解决办法

安装Xcode并执行以下命令

 sudo xcode-select -s /Applications/Xcode.app/Contents/Developer

你可能感兴趣的:(node-js)