Closed8

Claude Code is not supported on Windows.の解消とやり取りするための初期設定

enumura1enumura1

背景

claude code を試し使おうとしていた。
以下のドキュメントを参考。

https://docs.anthropic.com/ja/docs/claude-code/overview

環境

  • Vscode
  • Linux(WSL2)

事象

以下のコマンドを実行

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

以下のエラーが発生。
windows環境と認識されてる?

npm error Error: Claude Code is not supported on Windows.
npm error Claude Code requires macOS or Linux to run properly.
npm error If you are using WSL (Windows Subsystem for Linux):
npm error   1. Make sure you are running npm install from within the WSL terminal, not from PowerShell or CMD
npm error   2. If you're still seeing this message in WSL, your environment may be incorrectly reporting as Windows
npm error Please visit https://docs.anthropic.com/en/docs/agents-and-tools/claude-code/overview#check-system-requirements for troubleshooting information.
enumura1enumura1

node が入ってなかった。

$ node -v
Command 'node' not found, but can be installed with:

参考:https://note.com/ymtk00/n/n88620d4e6236

nodeとnpmをubuntuの環境にインストール。

 sudo apt install nodejs npm

インストールされたことを確認。

$ node -v
v18.19.1

$ npm -v
10.9.2
enumura1enumura1

再度claude codeをインストール。

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

まだエラーが出る状態。

npm error Error: Claude Code is not supported on Windows.
npm error Claude Code requires macOS or Linux to run properly.
npm error If you are using WSL (Windows Subsystem for Linux):
npm error   1. Make sure you are running npm install from within the WSL terminal, not from PowerShell or CMD
npm error   2. If you're still seeing this message in WSL, your environment may be incorrectly reporting as Windows
npm error Please visit https://docs.anthropic.com/en/docs/agents-and-tools/claude-code/overview#check-system-requirements for troubleshooting information.
enumura1enumura1

管理者権限でインストール。

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

うまくいってそうなことを確認。

t$ sudo npm install -g @anthropic-ai/claude-code

added 3 packages in 7s
2 packages are looking for funding
  run `npm fund` for details

claude コマンドを実行。

claude

参考:https://docs.anthropic.com/ja/docs/claude-code/overview#質問から解決策まで数秒で

claude codeを使えることを確認。

╭──────────────────────────╮
│ ✻ Welcome to Claude Code │
╰──────────────────────────╯

 Let's get started.

 Choose the text style that looks best with your terminal:
 To change this later, run /theme

 ❯ 1. Dark mode
   2. Light mode
   3. Dark mode (colorblind-friendly)
   4. Light mode (colorblind-friendly)
   5. Dark mode (ANSI colors only)
   6. Light mode (ANSI colors only)


 Preview

enumura1enumura1

ダークモードを選択。

Proプランの方選択

 ❯ 1. Claude account with subscription
      Starting at $20/mo for Pro, $100/mo for Max - Best value, predictable pricing

ブラウザ認証を通して再度ターミナルに戻ってくる。

enumura1enumura1

信頼するか聞かれるのでyesを選択。

 Claude Code may read files in this folder. Reading untrusted files may lead Claude Code to       │
│ behave in an unexpected ways.                                                                    │
│                                                                                                  │
│ With your permission Claude Code may execute files in this folder. Executing untrusted code is   │
│ unsafe.                                                                                          │
│                                                                                                  │
│ https://docs.anthropic.com/s/claude-code-security                                                │
│                                                                                                  │
│ ❯ 1. Yes, proceed                                                                                │
│   2. No, exit

初期設定は終わったように見える。

 Tips for getting started:

 1. Run /init to create a CLAUDE.md file with instructions for Claude
 2. Use Claude to help with file analysis, editing, bash commands and git
 3. Be as specific as you would with another engineer for the best results

 ※ Tip: Start with small features or bug fixes, tell Claude to propose a plan, and verify its 
 suggested edits

╭──────────────────────────────────────────────────────────────────────────────────────────────────╮
│ > Try "how does <filepath> work?"                                                                │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
  ? for shortcuts
enumura1enumura1

helloと入力してみると応答が返ってくることを確認。

 Tips for getting started:

 1. Run /init to create a CLAUDE.md file with instructions for Claude
 2. Use Claude to help with file analysis, editing, bash commands and git
 3. Be as specific as you would with another engineer for the best results

 ※ Tip: Start with small features or bug fixes, tell Claude to propose a plan, and verify its 
 suggested edits

> hello

● Hello! How can I help you with your React projects today?

╭──────────────────────────────────────────────────────────────────────────────────────────────────╮
│ >                                                                                                │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
  ? for shortcuts

日本語でも会話できることを確認。

> hello

● Hello! How can I help you with your React projects today?

> 日本語でも話せますか

● はい、日本語で話せます!何かお手伝いできることはありますか?
enumura1enumura1

現状だとVscodeの中央のターミナルで会話をしてる状態。
チャット欄を右に寄せたい。

ideコマンドを実行。

Select IDE

ターミナル > セカンダリ を選択。

右側にチャット欄が移動したことを確認。

このスクラップは2ヶ月前にクローズされました