1. 前置需求
    1. 安装node.js
    2. 安装git
    3. 梯子
  2. 使用如下命令行:
    irm https://claude.ai/install.ps1 | iex

    报错

    PS C:\windows\system32> irm https://claude.ai/install.ps1 | iex
    iex : 所在位置 行:1 字符: 2073
    + ... igin="anonymous"/><script type="text/javascript">!function(o,c){var n ...
    +                                                                 ~
    参数列表中缺少参量。
    所在位置 行:1 字符: 2077
    + ... anonymous"/><script type="text/javascript">!function(o,c){var n=c.doc ...
    +                                                               ~~~
    此语言版本中不支持“var”关键字。
    所在位置 行:1 字符: 2100
    + ... ype="text/javascript">!function(o,c){var n=c.documentElement,t=" w-mo ...
    +                                                                 ~
    参数列表中缺少参量。
    所在位置 行:1 字符: 2132
    + ... o,c){var n=c.documentElement,t=" w-mod-";n.className+=t+"js",("ontouc ...
    +                                                                 ~
    参数列表中缺少参量。
    所在位置 行:1 字符: 2148
    + ... mentElement,t=" w-mod-";n.className+=t+"js",("ontouchstart"in o||o.Do ...
    +                                                                ~~
    表达式或语句中包含意外的标记“in”。
    所在位置 行:1 字符: 2148
    + ... cumentElement,t=" w-mod-";n.className+=t+"js",("ontouchstart"in o||o. ...
    +                                                                  ~
    表达式中缺少右“)”。
    所在位置 行:1 字符: 2152
    + ... Element,t=" w-mod-";n.className+=t+"js",("ontouchstart"in o||o.Docume ...
    +                                                                ~~
    标记“||”不是此版本中的有效语句分隔符。
    所在位置 行:1 字符: 2169
    + ... -";n.className+=t+"js",("ontouchstart"in o||o.DocumentTouch&&c instan ...
    +                                                                ~~
    标记“&&”不是此版本中的有效语句分隔符。
    所在位置 行:1 字符: 2076
    + ... n="anonymous"/><script type="text/javascript">!function(o,c){var n=c. ...
    +                                                                 ~
    语句块或类型定义中缺少右“}”。
    所在位置 行:1 字符: 2197
    + ... touchstart"in o||o.DocumentTouch&&c instanceof DocumentTouch)&&(n.cla ...
    +                                                                 ~
    表达式或语句中包含意外的标记“)”。
    并未报告所有分析错误。请更正报告的错误并重试。
    所在位置 行:1 字符: 37
    + irm https://claude.ai/install.ps1 | iex
    +                                     ~~~
        + CategoryInfo          : ParserError: (:) [Invoke-Expression], ParseException
        + FullyQualifiedErrorId : MissingArgument,Microsoft.PowerShell.Commands.InvokeExpressionCommand
    
    

    需要魔法上网

  3. 安装完成提示
    Claude Code on Windows requires git-bash (https://git-scm.com/downloads/win). If installed but not in PATH, set environment variable pointing to your bash.exe, similar to: CLAUDE_CODE_GIT_BASH_PATH=C:\Program Files\Git\bin\bash.exe

    下载git,或者添加环境变量

  4. 添加环境变量

    默认最常见路径是 C:\Program Files\Git\bin\bash.exe

    如果您安装时改了路径,通常会在 ...\Git\bin\ 目录下。您可以直接在文件资源管理器中搜索 bash.exe 来找到它。

    设置环境变量:

    在 Windows 搜索框输入 编辑系统环境变量 并打开。

    点击下方的 环境变量... 按钮。

    在“用户变量”或“系统变量”部分,点击 新建...。

    变量名:CLAUDE_CODE_GIT_BASH_PATH

    变量值:粘贴找到的路径,例如 C:\Program Files\Git\bin\bash.exe

    点击确定保存所有对话框。

    重启 Claude Code / VS Code:

    完全关闭 Claude Code 或 VS Code,再重新打开,让它识别新的环境变量。

Logo

Agent 垂直技术社区,欢迎活跃、内容共建。

更多推荐