58
67

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【小ネタ】GitとVSCodeがあればWindowsでもClaude Codeを使えるぅ!(WSLもいらない)

Last updated at Posted at 2025-06-30

2025/7/13 Claude Codeの最新版(バージョン1.0.51)でネイティブWindows(コマンドプロンプト/PowerShell)に対応しました。最新の方法はこちらの投稿を参考にしてください。

Claude CodeがネイティブWindowsをサポートしました🎉🎉🎉Bedrock APIキーにも対応!!!
https://qiita.com/moritalous/items/fd017758b2ccf842dc1a


Windowsで開発している皆さんのPCには、GitとVSCodeはインストール済みですよね?

おめでとうございます。皆さんの環境でWSLなしでCalude Code使えます。

Claude CodeをWindowsで動作させるにはWSLが必要

セットアップガイドによると、WindowsでClaude Codeを使用したい場合はWSL環境が必要とのことです。

私は普段からWSLを使用しているので問題ありませんが、Claude Codeをちょっと試すためにWSLをインストールしてねというのは忍びない。

ということで試行錯誤の結果、WSLなしでも動作させることに成功したので手順を紹介します。

公式でサポートされているわけではないので、自己責任でお願いします。

とりあえずNode.jsをインストール

GitとVSCodeはインストール済みと思いますので、Node.jsをインストールしましょう。インストール済みであればOKです。普通にWindows版でOKです。

Claude Codeをインストール

それではClaude Codeをインストールしていきましょう。

まず、VSCodeを起動します。

image.png

新しいターミナルを起動します。

image.png

PowerShellのターミナルが起動すると思います。ここで「+」ボタンをクリックし、「Git Bash」を選択します。

image.png

すると、普段見慣れないターミナルが起動します。これはGit Bashというもので、Git for Windowsをインストールすると導入されます。

image.png

Claude Codeは動作上シェル環境(Bash、Zsh、Fish)が必要になるので、通常のWindowsは非対応なのですが、Git Bashがあることで、Windows環境でもClaude Codeが起動できるのです。

では、Claude Codeをインストールします。ここでも、コマンドにひと工夫します。--ignore-scriptsをつけてインストールします。

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

スクリプトを実行しなくていいの?と疑問に思ったと思いますが、バージョン1.0.35(2025/6/30時点の最新バージョン)のスクリプトはこんな内容です。

/**
 * Preinstall script to check for Windows environment and exit gracefully 
 * with an informative message if detected.
 */

// Check if running on Windows
if (process.platform === 'win32') {
  console.error('\x1b[31m%s\x1b[0m', 'Error: Claude Code is not supported on Windows.');
  console.error('\x1b[33m%s\x1b[0m', 'Claude Code requires macOS or Linux to run properly.');
  console.error('\x1b[33m%s\x1b[0m', 'If you are using WSL (Windows Subsystem for Linux):');
  console.error('\x1b[33m%s\x1b[0m', '  1. Make sure you are running npm install from within the WSL terminal, not from PowerShell or CMD');
  console.error('\x1b[33m%s\x1b[0m', '  2. If you\'re still seeing this message in WSL, your environment may be incorrectly reporting as Windows');
  console.error('\x1b[33m%s\x1b[0m', 'Please visit https://docs.anthropic.com/en/docs/agents-and-tools/claude-code/overview#check-system-requirements for troubleshooting information.');
  process.exit(1);
}

「Windowsでは動かないよー」とメッセージを出すだけですが、これによりWindowsの場合、インストールに失敗します。実害はないため、Scriptの実行を抑制しインストールします。

インストールできたら、claudeでClaude Codeが起動します。

image.png

やったね!

ちょっとだけ動かしてみましたが、一応動いているようです。ただ、エラーメッセージが表示されるのであまり精神衛生上よくありませんw

image.png

おとなしくWSL使ったほうが良さそうです!

58
67
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
58
67

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?