檢查系統需求

  • 作業系統: macOS 10.15+、Ubuntu 20.04+/Debian 10+ 或透過 WSL 使用 Windows
  • 硬體: 最低 4GB RAM
  • 軟體:
    • Node.js 18+
    • git 2.23+ (選用)
    • GitHubGitLab CLI 用於 PR 工作流程 (選用)
    • ripgrep (rg) 用於增強檔案搜尋 (選用)
  • 網路: 需要網路連線以進行驗證和 AI 處理
  • 地區: 僅在支援的國家可用

WSL 安裝疑難排解

目前,Claude Code 無法直接在 Windows 上運行,需要使用 WSL。如果您在 WSL 中遇到問題:

  1. 作業系統/平台偵測問題:如果在安裝過程中收到錯誤,WSL 可能正在使用 Windows 的 npm。請嘗試:

    • 在安裝前執行 npm config set os linux
    • 使用 npm install -g @anthropic-ai/claude-code --force --no-os-check 進行安裝(請勿使用 sudo
  2. 找不到 Node 錯誤:如果在執行 claude 時看到 exec: node: not found,您的 WSL 環境可能正在使用 Windows 版本的 Node.js。您可以使用 which npmwhich node 確認,這些命令應該指向以 /usr/ 開頭的 Linux 路徑,而不是 /mnt/c/。要解決此問題,請嘗試透過 Linux 發行版的套件管理器或 nvm 安裝 Node。

安裝和驗證

1

安裝 Claude Code

Install NodeJS 18+, then run:

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

Do NOT use sudo npm install -g as this can lead to permission issues and security risks. If you encounter permission errors, see configure Claude Code for recommended solutions.

2

導航到您的專案

cd your-project-directory 
3

啟動 Claude Code

claude
4

完成驗證

Claude Code 提供多種驗證選項:

  1. Anthropic Console:預設選項。透過 Anthropic Console 連接並完成 OAuth 流程。需要在 console.anthropic.com 啟用計費。
  2. Claude App(含 Max 方案):訂閱 Claude 的 Max 方案,單一訂閱即可同時使用 Claude Code 和網頁介面。以相同價格獲得更多價值,同時在一處管理您的帳戶。使用您的 Claude.ai 帳戶登入。在啟動時,選擇與您的訂閱類型相符的選項。
  3. 企業平台:設定 Claude Code 以使用 Amazon Bedrock 或 Google Vertex AI 進行企業部署,搭配您現有的雲端基礎設施。

初始化您的專案

對於首次使用者,我們建議:

1

啟動 Claude Code

claude
2

執行簡單命令

summarize this project
3

生成 CLAUDE.md 專案指南

/init 
4

提交生成的 CLAUDE.md 檔案

請 Claude 將生成的 CLAUDE.md 檔案提交到您的儲存庫。

Was this page helpful?