![](/img/trans.png)
[英]`npm install` fails on node-gyp rebuild with `env: python: No such file or directory` on mac pro m1
[英]node-gyp rebuild fails on Mac OS High Sierra while npm install
我在終端中遇到以下錯誤,同時它嘗試安裝“node-expat”包之一。 我曾嘗試使用 nvm 切換到不同的節點版本,但仍然因相同的錯誤而失敗。
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/node-expat
npm ERR! node v6.5.0
npm ERR! npm v3.10.3
npm ERR! code ELIFECYCLE
npm ERR! node-expat@2.0.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-expat@2.0.0 install script 'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the node-expat package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs node-expat
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls node-expat
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! c:\<redacted>\npm-debug.log
我繼續按照git hub頁面上的建議在我的機器上安裝x-code,然后出現以下錯誤。 不確定如何進一步調試。
xcode-select: error: tool 'xcodebuild' requires Xcode,
but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
我剛把它固定在我的機器和我同事的機器上。
按照以下步驟在 MacOS highSierra 10.13 上修復它:
Luke 上面提到的解決方案部分對我有用(MacOS),但產生了另一個問題: gyp ERR! stack Error:
gyp ERR! stack Error:
make failed with exit code: 2
已通過刪除鎖定的 json 文件解決。 問題是由於 MAC OS 中的許可而產生的。 因此,如果您已經重新安裝了 xcode,請打開終端(命令行)並鍵入:
xcode-select --reset
然后轉到您的項目文件夾並刪除: package-lock.json現在在終端中重新安裝項目:
npm install
我希望這可以幫助別人!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.