xcrun: error: invalid active developer path (/Applications/Xcode.app/Contents/Developer), missing xcrun at: /Applications/Xcode.app/Contents/Developer/usr/bin/xcrun
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (/Users/bj00031ml/test/starfish-h5/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack at ChildProcess.emit (node:events:526:28)
gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
gyp ERR! System Darwin 21.1.0
gyp ERR! command "/usr/local/bin/node" "/Users/bj00031ml/test/starfish-h5/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /Users/bj00031ml/test/starfish-h5/node_modules/node-sass
gyp ERR! node -v v16.14.2
问题原因
xcrun未安装或指向错误
解决方案
# 查看
$ xcode-select -p
/Applications/Xcode.app/Contents/Developer
# 若查看没有则安装
$ xcode-select --install
# 重置
$ sudo sudo xcode-select -r
Password:
# 查看
$ xcode-select -p
/Applications/Xcode.app/Contents/Developer
# 切换
$ sudo xcode-select --switch /Library/Developer/CommandLineTools
# 或
$ sudo xcode-select --switch /Applications/Xcode.app
# 或
sudo xcode-select --switch /Library/Developer/CommandLineTools
# 查看
$ xcode-select -p
/Library/Developer/CommandLineTools
相关链接
stackoverflow
网友评论