2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

macOS 10.15 Catalinaでwebpackをインストールしようとしてエラーになった

Last updated at Posted at 2020-01-14

環境

  • macOS 10.5
  • node 8.5.0
  • npm 5.3.0

手順

プロジェクトディレクトリでwebpackをインストールします。

npm i -D webpack

下記のエラーが出ます。

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
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 
gyp ERR! stack     at emitTwo (events.js:125:13)
gyp ERR! stack     at ChildProcess.emit (events.js:213:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Darwin 19.2.0
gyp ERR! command "/Users/hiro/.nodebrew/node/v8.5.0/bin/node" "/Users/xxxx/.nodebrew/node/v8.5.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! node -v v8.5.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm WARN webpack-test@1.0.0 No description
npm WARN webpack-test@1.0.0 No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules/fsevents):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 install: `node-gyp rebuild`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1```

node-gyp.jsのインストールでエラーが出てるようです。

対策

Xcodeが入ってなかったので、AppStoreからXcodeをインストール。
が、それでも同じエラーが出るためCommand Line ToolsをXcode同梱版を使うように指定します。

sudo xcode-select --switch /Applications/Xcode.app

これで、node-gyp.jsがインストールされて、webpackもインストールされました。

2
3
0

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
2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?