Files
claude-code/docs/getting-started/installation.mdx
claude-code-best 37dac682b9 docs: 文档大重组,对齐 README 入口
以 README 为单一事实来源,重构整个 docs/ 目录。

最终结构(3 大组、15 篇文档):
- 开始: installation / quickstart / model-providers
- 核心功能: pipes-and-lan、acp、channels、chrome-control、computer-use、
  voice-mode、web-browser-tool、auto-dream、remote-control-self-hosting、
  langfuse-monitoring
- 内部机制: growthbook-adapter、sentry-setup

主要变更:
- 删除 56 个 README 未提及的文档(architecture 全部 / guides 全部 /
  features 中未在 README 出现的 20 篇 / internals 中的 5 篇)
- 合并 6 组重复文档(pipes-and-lan、chrome-control、acp、computer-use、
  auto-dream、coordinator-mode 简化为入口)
- features 子组从 5 → 4,ui/ 合并入 tools/
- 所有保留文档加上人性化 frontmatter(title/description/keywords)
- docs.json navigation 简化为 3 大组,redirects 重新过滤为 7 条合并跳转
- 新增 docs.md 工作大纲与验证脚本(verify-docs / check-docs-orphans /
  dump-docs-outline)

总计 130 文件改动,从约 35000 行精简到约 2000 行。

Co-Authored-By: glm-5.2 <zai-org@claude-code-best.win>
2026-06-15 16:51:29 +08:00

126 lines
3.6 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: "安装 Claude Code Best"
description: "通过 NPM 一行命令安装 CCB或从源码克隆构建。支持 macOS、Linux、Windows。"
keywords: ["安装", "CCB", "NPM", "源码构建", "Bun"]
og:image: "https://ccb.agent-aura.top/docs/images/og-cover.png"
---
CCB 提供两种安装方式:**NPM 安装**(推荐普通用户)和**源码构建**(推荐贡献者/二次开发者)。
## 方式一NPM 安装(推荐)
无需克隆仓库,一行命令安装到全局:
```sh
npm i -g claude-code-best
# 验证
ccb --version
```
启动方式:
```sh
ccb # 以 Node.js 形态运行
ccb-bun # 以 Bun 形态运行(启动更快)
ccb update # 更新到最新版本
```
> 💡 **不推荐** `bun i -g claude-code-best`bun 全局安装在部分平台有路径冲突问题,建议用 npm。如果一定要用 bun记得 `bun pm -g trust claude-code-best @claude-code-best/mcp-chrome-bridge` 解除信任限制。
### 远程控制模式(可选)
如果你有自己的 Remote Control Server可以通过环境变量直连
```sh
CLAUDE_BRIDGE_BASE_URL=https://your-rcs.example.com/ \
CLAUDE_BRIDGE_OAUTH_TOKEN=your-token \
ccb --remote-control
```
详情见 [Remote Control 自托管](../features/modes/remote-control-self-hosting)。
### 安装失败排查
| 症状 | 处理 |
|------|------|
| `command not found: ccb` | 重开终端,或手动把 npm global bin 加入 PATH |
| 旧版本残留导致异常 | `npm rm -g claude-code-best && npm i -g claude-code-best@latest` |
| 拉取特定版本 | `npm i -g claude-code-best@<版本号>` |
| Windows 上启动报错 | 改用 `ccb-bun` 或安装 [Visual C++ Redistributable](https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist) |
---
## 方式二:源码构建(贡献者)
源码运行需要 **Bun ≥ 1.3.11**。
### 1. 安装 Bun
```bash
# Linux / macOS
curl -fsSL https://bun.sh/install | bash
# Windows (PowerShell)
powershell -c "irm bun.sh/install.ps1 | iex"
```
安装后让当前 shell 识别 bun
```bash
exec /bin/zsh # macOS 默认 zsh
# 或
source ~/.bashrc # Linux bash
```
> ⚠️ **一定要最新版 bun**`bun upgrade`。低版本会触发各种奇怪的 BUG。
### 2. 克隆并安装依赖
```bash
git clone https://github.com/claude-code-best/claude-code.git
cd claude-code
bun install
```
### 3. 开发模式运行
```bash
bun run dev # 默认开发模式(启用所有 feature
bun run dev:inspect # 带调试器BUN_INSPECT=9229 改端口)
echo "say hello" | bun run src/entrypoints/cli.tsx -p # Pipe 模式
```
### 4. 构建产物
```bash
bun run build # 默认 Bun.build输出 dist/cli.js + chunks/
bun run build:vite # 备选 Vite 构建chunk 体积更小)
```
构建后可直接用 node 运行:
```bash
node dist/cli.js
```
> 🔍 **为什么 Vite 构建强制代码分割?** 单文件 17MB 产物会让 Bun/JSC 全量解析 bytecodeRSS 暴涨至 ~1GB分割为 600+ 小 chunk 后按需加载,`--version` RSS 从 966MB 降至 35MB。详见 [architecture/](../architecture/what-is-claude-code)。
### 5. 提交前检查
每次修改后必须运行:
```bash
bun run precheck # typecheck + lint fix + test
```
`precheck` 必须零错误通过pre-commit hook 会自动拦截不合格的提交。
---
## 下一步
- [快速上手](./quickstart) — 5 分钟学会基本使用
- [配置模型供应商](./model-providers) — 接入 DeepSeek、GLM、OpenAI 等第三方模型
- [Feature Flags](../internals/feature-flags) — 了解运行时功能开关