LoginSignup
23

More than 3 years have passed since last update.

npm install時のエラー解決 No Xcode or CLT version detected!

Posted at

環境

macOS Catalina 10.15.4
npm 6.14.5

以下のエラーが出た時の解決

No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'.

No receipt for 'com.apple.pkg.DeveloperToolsCLILeo' found at '/'.

No receipt for 'com.apple.pkg.DeveloperToolsCLI' found at '/'.

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/izumi/.anyenv/envs/nodenv/versions/14.3.0/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351: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! node -v v14.3.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok

原因

Xcode Command Line Toolsの割当がおかしかった

$ xcode-select -p
/Library/Developer/CommandLineTools

解決方法

Xcodeがインストール済かどうかで対処方法が変わります。

Xcodeインストール済の場合

xcode-select -sでXcode内のCommandLineToolsにセットし直したら解決

$ sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
$ xcode-select -p
/Applications/Xcode.app/Contents/Developer

Xcode未インストールの場合

多分以下で解決するはず
(この方法実際に試せていないので解決しなかったらごめんなさい)

$ xcode-select --install

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
23