hAcKTion

日々のアウトプット場所。

あるはずなのに、No Xcode or CLT version detected! と言われる

Nuxtをアップグレードしようとしてnpm installをしていたら、途中で以下のメッセージが。 これがでても、特にnpm installがストップされないので、ほったらかししてたら気づかなかったかもしれない。

> node-gyp rebuild



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/hogehoge/.anyenv/envs/nodenv/versions/12.15.0/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16)

gyp ERR! stack     at ChildProcess.emit (events.js:223: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 "/Users/hogehoge/.anyenv/envs/nodenv/versions/12.15.0/bin/node" "/Users/hogehoge/.anyenv/envs/nodenv/versions/12.15.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"

gyp ERR! cwd /Users/hogehoge/Path/To/Root/node_modules/fsevents

gyp ERR! node -v v12.15.0

gyp ERR! node-gyp -v v5.0.5

gyp ERR! not ok

ただ、インストールしてなかったっけ?パス通ってなかったっけ?と思って調べてもそうではなさそう。

> xcode-select -print-path 
/Library/Developer/CommandLineTools

> xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates

入れ直してみたら、いけました。

> sudo rm -rf /Library/Developer/CommandLineTools

> xcode-select --install
xcode-select: note: install requested for command line developer tools

> npm install
> node-gyp rebuild

  SOLINK_MODULE(target) Release/.node
  CXX(target) Release/obj.target/fse/fsevents.o
  SOLINK_MODULE(target) Release/fse.node

> grpc@1.24.2 install /Users/hogehoge/Path/To/Root/node_modules/grpc
> node-pre-gyp install --fallback-to-build --library=static_library