mac 执行 npm install 时报错 gyp: No X
2020-05-19 本文已影响0人
noyanse
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/argen/Desktop/code/work/2020/220/finwhale/marketing-center/node_modules/node-gyp/lib/configure.js:345:16)
gyp ERR! stack at ChildProcess.emit (events.js:315:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:276:12)
gyp ERR! System Darwin 19.4.0
gyp ERR! command "/usr/local/bin/node" "/Users/argen/Desktop/code/work/2020/220/finwhale/marketing-center/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /Users/argen/Desktop/code/work/2020/220/finwhale/marketing-center/node_modules/node-sass
gyp ERR! node -v v14.2.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok

解决办法:
sudo xcode-select --install
xcode-select --print-path // 曾经安装过的路径
sudo rm -rf /Library/Developer/CommandLineTools // 删掉之前的
sudo xcode-select --install // 再安装一次
gcc -v // 查看是否安装成功
