Source: https://aiprimetech.io/zh/claude-code/errors/process-exited-code-1/ [首页](/zh/) › [Claude Code](/claude-code/zh/) › [错误](/zh/claude-code/errors/) › 已退出,退出码为 1 [概览](/claude-code/zh/)[安装](/claude-code/zh/install/)[CLI 参考文档](/zh/claude-code/cli/)[定价与限制](/claude-code/zh/pricing/)[Agent SDK](/zh/claude-code/sdk/)[技能与插件](/zh/claude-code/skills/)[GitHub](/zh/claude-code/github/)[网页、桌面与 IDE](/zh/claude-code/web-and-desktop/)[模型](/zh/claude-code/models/)[错误](/zh/claude-code/errors/)[是否开源?](/zh/claude-code/open-source/)[教程](/claude-code/zh/tutorial/)[学生指南](/zh/claude-code/for-students/)[QA 自动化](/zh/claude-code/qa-automation/)[与 Cursor 对比](/zh/claude-code/vs-cursor/)[与 Codex 和 OpenCode 对比](/zh/claude-code/vs-codex/)[子智能体](/zh/claude-code/subagents/)[钩子](/zh/claude-code/hooks/)[MCP](/zh/claude-code/mcp/)[生态系统](/zh/claude-code/ecosystem/)[VS Code](/zh/claude-code/vscode/)[OpenRouter](/zh/claude-code/openrouter/)[速率限制](/zh/claude-code/rate-limits/)[中文指南](/claude-code/zh/) 最后更新:2026 年 11 月 # “Claude Code 进程退出,退出码为 1”:如何找到真正的错误并修复 “Claude Code 进程已退出,退出码为 1”是封装程序显示的消息:VS Code 扩展或桌面应用启动了 claude CLI,而 CLI 在来得及说明原因之前就终止了。修复的第一步是获取它的真实错误。 ## TLDR - 运行 claude 在普通终端中运行——CLI 会打印封装程序隐藏的实际错误。 - 常见原因:过旧的 Node.js / PATH、无效的 settings.json、卡住的后台会话、Windows 上的孤立进程。 - claude doctor 会检查安装情况;使用原生安装程序重新安装可修复大多数损坏的安装。 - Windows:如果应用崩溃后无法重新启动,完全重启系统可清除孤立进程持有的锁。 ## 步骤 1:获取真实错误 ``` claude --version # is the CLI there at all? claude # start it directly: the real error prints here claude doctor # install health check ``` 如果终端中运行正常,只有扩展或应用失败,那么问题出在封装程序启动时所用的环境(PATH、Node 版本、代理变量),而非 Claude Code 本身。如果终端中也失败,应搜索它打印的错误消息。 ## 已知原因(来自问题跟踪器) - 在 VS Code 中恢复后台会话。 打开通过以下命令启动的会话: claude --bg 会抛出完全相同的错误——macOS、Windows 和 Linux 上均有人报告([#77162](https://github.com/anthropics/claude-code/issues/77162))。先停止后台智能体,或打开新会话。 - Windows:崩溃后留下孤立进程。 应用无法重新启动,因为旧进程仍持有锁([#42776](https://github.com/anthropics/claude-code/issues/42776), [#53247](https://github.com/anthropics/claude-code/issues/53247))。在任务管理器中终止残留的 claude 进程;该报告中提到的可靠解决方法是完全重启 Windows。 - Apple Silicon 上的桌面应用 每次启动会话都会失败,但 CLI 正常工作([#59866](https://github.com/anthropics/claude-code/issues/59866),与一个已知问题重复)——更新应用;在此期间,可在终端中使用 CLI。 - Node.js 版本低于 18,或 PATH 损坏 出现在 npm 安装之后——封装程序无法启动 CLI。 node -v;改用原生安装程序可消除对 Node 的依赖。 - 无效的 `~/.claude/settings.json`。 钩子或权限配置块中多余的逗号会导致 CLI 立即退出。请验证 JSON。 - Windows shell 不匹配 ——使用特定模型时,从 Git Bash 运行 PowerShell 工具失败([#87980](https://github.com/anthropics/claude-code/issues/87980));尝试另一种 shell。 ## 如果上述情况均不适用 - 更新所有组件: claude update,并更新 VS Code 扩展或桌面应用。 - 使用原生安装程序重新安装(curl -fsSL https://claude.ai/install.sh | bash,或使用以下文档中的 PowerShell / CMD 单行命令: [安装指南](/claude-code/zh/install/)). - 从终端启动 VS Code,使其继承与正常工作的 CLI 相同的环境。 - 提交新问题,并附上以下命令的输出: claude doctor ——问题跟踪器会快速分诊崩溃问题。 ## 相关内容 如果 Claude Code 能启动,但随后因 API 错误而失败,那是另一个问题:参见 [API 错误 500](/zh/claude-code/errors/api-error-500/), [过载 / 529](/zh/claude-code/errors/overloaded-529/), [API 错误 400](/zh/claude-code/errors/api-error-400/) 或 [OAuth 错误](/zh/claude-code/errors/oauth-error/)。针对扩展的具体问题,请参见 [VS Code 中的 Claude Code](/zh/claude-code/vscode/). ## 厌倦了与这个问题反复较劲? 改为通过 AI Prime Tech 网关运行 Claude Code:使用相同的 Claude 模型,由网关自己的上游账户提供服务,设置两个环境变量即可切换,新账户可获得 $5 免费 API 额度 使用优惠码 FIXIT — 无需银行卡。 ``` export ANTHROPIC_BASE_URL=https://aiprimetech.io export ANTHROPIC_API_KEY=your_key ``` [使用优惠码 FIXIT 创建账户](/register?promo=FIXIT) ## 常见问题 “Claude Code 进程已退出,退出码为 1”是什么意思? VS Code 扩展或桌面应用启动了 Claude Code CLI,但它因错误而退出。在终端中运行 claude,查看实际错误消息。如何在 Windows 上修复 Claude Code 退出码为 1 的问题? 终止残留的 claude 进程(如果应用无法重新启动,则重启 Windows),检查 node -v 和 PATH,验证 ~/.claude/settings.json,并在需要时使用原生安装程序重新安装。为什么 Claude Code 在终端中正常工作,却无法在 VS Code 中运行? VS Code 启动时使用了不同的环境(PATH、Node、代理变量)。从能正常运行 claude 的终端启动 VS Code,或修正 shell 配置文件中的变量。 ## 通过网关运行 Claude Code 相同的模型,两个环境变量,面值 7.69231 倍的额度,或固定费率不限量方案。 新账户:使用优惠码 FIXIT 可获得 $5 免费 API 额度。[获取 API 密钥](/register?promo=FIXIT) [查看不限量方案](/zh/plans/) AI Prime Tech 是独立的 API 网关,与 Anthropic 无关联,也未获得其认可或赞助。“Claude”和“Claude Code”是 Anthropic 的商标。此处介绍的 Claude Code 功能以撰写时 Anthropic 的公开文档为依据,且经常发生变化;本页面的价格和模型列表读取自此网关的实时设置。 ## 更多 Claude Code 指南 [Claude Code 错误及修复方法](/zh/claude-code/errors/)[Claude Code“API 错误:500”:含义及真正有效的修复方法](/zh/claude-code/errors/api-error-500/)[Claude“过载”错误(API 错误 529):含义及应对方法](/zh/claude-code/errors/overloaded-529/)[Claude Code API 错误 400:提示词过长、工具使用并发问题及其他错误](/zh/claude-code/errors/api-error-400/)[Claude Code OAuth 错误:超出 15000ms 超时时限,以及状态码 500](/zh/claude-code/errors/oauth-error/)[Claude“提示词过长”“输入对于请求的模型而言过长”和“已达到上下文上限”:什么占满了窗口,以及如何释放空间](/zh/claude-code/errors/prompt-too-long/)[已达到 Claude 使用上限:会话、每周和 Opus 上限、“指定的 API 使用上限”、“额度余额过低” — 以及应对方法](/zh/claude-code/errors/usage-limit-reached/)[Claude Code 401 和 403:身份验证凭据无效、API 密钥无效、“未登录”、host_not_allowed](/zh/claude-code/errors/auth-401-403/)[Claude Code 连接错误:ECONNRESET、响应中途连接丢失、“正在等待 API 响应”、“无法连接到 API”、SSL 证书错误](/zh/claude-code/errors/connection-lost/)[Claude Code 挂起、卡住或停止响应:如何定位卡住的位置并恢复](/zh/claude-code/errors/claude-code-hangs/)[Claude.ai 无法正常使用:“出了点问题”、容量限制、“已达到 5 小时上限”、“登录时出错”及其他问题](/zh/claude-code/errors/claude-ai-not-working/)