🐕

Claude Codeは、Windowsでは苦労しますので

に公開

Claudeの新しい機能のClaude Codeを試しました。
私は、Windows11ですが、下記のエラーが出ました。

npm install -g @anthropic-ai/claude-code

added 2 packages in 8s

1 package is looking for funding
  run `npm fund` for details
npm notice
npm notice New minor version of npm available! 11.0.0 -> 11.1.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v11.1.0
npm notice To update run: npm install -g npm@11.1.0
npm notice

\Claudeコードテスト> npm install -g npm@11.1.0

changed 21 packages in 5s

24 packages are looking for funding
  run `npm fund` for details
PS D:\自分の開発研究\Claudeコードテスト> claude --version
0.2.9
Error: spawn /bin/bash ENOENT
    at ChildProcess._handle.onexit (node:internal/child_process:286:19)
    at onErrorNT (node:internal/child_process:484:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'spawn /bin/bash',
  path: '/bin/bash',
  spawnargs: [ '-l' ]
}
This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:
Error: kill EINVAL
    at ChildProcess.kill (node:internal/child_process:509:13)
    at m8.close (file:///C:/*****/npm/node_modules/@anthropic-ai/claude-code/cli.mjs:340:511)
    at process.<anonymous> (file:///C:/***/npm/node_modules/@anthropic-ai/claude-code/cli.mjs:1398:5197)
    at process.emit (node:events:519:28)
    at process.emit (node:domain:488:12)
    at process.exit (node:internal/process/per_thread:185:15)
    at VN1._exit (file:///C:/***/npm/node_modules/@anthropic-ai/claude-code/cli.mjs:322:357)
    at VN1.<anonymous> (file:///C:/***/npm/node_modules/@anthropic-ai/claude-code/cli.mjs:330:9)
    at VN1.emit (node:events:519:28)
    at VN1.emit (node:domain:488:12)

エラー「spawn /bin/bash ENOENT」は、Windows環境でUnix系のシェル(/bin/bash)が見つからないために発生しています。これは、Node.jsのspawn関数がデフォルトでUnix系のシェルを呼び出そうとするためです。

WSLを利用するのが良いです

Windowsで肺活しているときにClaude Codeを使い固いときは、WSLでClaude Codeを使うと良いです。

Discussion