Mac 升級(jí)到12.3以上 python2.7 刪除了
遇到的一系列問(wèn)題:
1、ws 打不開(kāi)webstorm
webstorm 也識(shí)別不了node路徑
報(bào)錯(cuò):
env: python: No such file or directory
參考:https://blog.51cto.com/u_7075695/5269502
解決辦法
Python 指向 python3
? ln -s /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/bin/python3 /usr/local/bin/python3
? ln -s -f /usr/local/bin/python3 /usr/local/bin/python
沒(méi)有權(quán)限加sudo
解除軟連接:
sudo rm /usr/local/bin/python
2净薛、npm I
node install.js
報(bào)錯(cuò):
configure error
gyp ERR! stack Error: Command failed: /usr/local/bin/python -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack File "<string>", line 1
就是node版本和python版本沖突
解決辦法:
升級(jí)node到12.22 以上
3荐开、M1 nvm安裝node (nvm install 11.15.0)
報(bào)錯(cuò):
Checksums matched! $>./configure --prefix=/Users/fangfei/.nvm/versions/node/v11.15.0 < Please use either Python 2.6 or 2.7
那是因?yàn)閙1 芯片nvm安裝低版本的一定要加 arch -x86_64 zsh 每安裝一次都要執(zhí)行該命令
解決方案:
arch -x86_64 zsh
4确丢、NPM Error:gyp: No Xcode or CLT version detected!
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 (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16)
gyp ERR! stack at ChildProcess.emit (events.js:210:5)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Darwin 19.3.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/yangjian/Documents/temp/test001/node_modules/fsevents
gyp ERR! node -v v12.13.0
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok
解決方案:
$ sudo rm -rf $(xcode-select -print-path)
$ xcode-select --install
參考:https://www.cnblogs.com/zhennann/p/12272058.html
最終解決方案:
安裝python2.7
下載地址: https://www.python.org/ftp/python/2.7.18/python-2.7.18-macosx10.9.pkg
直接安裝就可以了
安裝完成之后需要執(zhí)行
npm config set python python
以上就是升級(jí)12.3以上版本之后遇到的坑魂那。后續(xù)還遇到的話(huà)六敬,會(huì)補(bǔ)充進(jìn)來(lái)。