🚒
Mac で突然 node-gyp のエラーが出た時の対処法
TL;DR
-
pkgutil --packages | grep CL
して出力が出ないことを確認 yarn cache clean
sudo rm -rf $(xcode-select -print-path)
xcode-select --install
- 4 が "xcode このソフトウェアは、現在ソフトウェア・アップデート・サーバから入手できないため、インストールできません。" などと言われて失敗する時はApple公式サイトから Xcode Command Line Tools をダウンロードしてインストールする
-
pkgutil --packages | grep CL
して出力が出ることを確認
突然 node-gyp のエラーが出た
.NET Core のチュートリアル Authentication and authorization for SPAs
を実施するにあたって dotnet run
で yarn が走ったときに以下のようなエラーが出た
EXEC : gyp ERR! stack error : `gyp` failed with exit code: 1 [angularIndividualTest.csproj]
EXEC : gyp ERR! stack error : `gyp` failed with exit code: 1 [angularIndividualTest.csproj]
EXEC : gyp ERR! stack error : `gyp` failed with exit code: 1 [angularIndividualTest.csproj]
EXEC : gyp ERR! stack error : `gyp` failed with exit code: 1 [angularIndividualTest.csproj]
EXEC : Build failed with error code: 1 [angularIndividualTest.csproj]
angularIndividualTest.csproj(43,5): error MSB3073: コマンド "npm install" はコード -1 で終了しました。
ビルドに失敗しました。ビルド エラーを修正して、もう一度実行してください。
調べたところ、 node-gyp でエラーが出ているらしく
Xcode Command Line Tools を再インストールすればいいらしいのだが
xcode-select --install
がコケるので別の方法が必要だった
参考
- Macでyarn installしたらnode-gypのエラーが出た - Qiita
- xcode-select --installに失敗した - yn2011's blog
Discussion