在开始使用Claude Code进行本地开发、跨境项目构建或AI辅助编程之前,你需要安装三个核心运行时工具。这些依赖项是不可或缺的——缺少任何一个都会导致启动失败、权限错误或执行问题。本指南提供了针对Windows、macOS和Linux的系统特定一键安装步骤,专为海外开发者量身定制,帮助大家简化预配置流程。
Node.js提供基础运行环境,使CLI操作、依赖安装和项目执行成为可能。Git促进代码版本控制、仓库同步、本地提交和远程推送,对于全球团队协作至关重要。终端增强工具优化命令行输入输出,提升操作效率,确保跨全球系统的兼容性。通过本教程,你将能顺利完成这三个工具的安装,为后续使用Claude Code奠定坚实基础。
无论你使用Windows、macOS还是Linux,本指南都提供了详细的安装步骤和验证方法。完成这三个工具的安装后,你就可以进入下一步,正式安装和配置Claude Code,开始你的AI辅助编程之旅。这套环境配置方案已经在多个操作系统上经过验证,能够确保Claude Code的稳定运行和最佳性能表现。
Before diving into Claude Code for local development, cross-border project building, or AI-powered programming, you need to set up three core runtime tools. These dependencies are non-negotiable—missing any will trigger startup failures, permission errors, or execution issues. This guide provides system-specific, one-click installation steps for Windows, macOS, and Linux, tailored for overseas developers to streamline pre-configuration.
The Three Indispensable Core Tools
- **Node.js**: Powers the basic runtime environment, enabling CLI operations, dependency installation, and project execution.
- **Git**: Facilitates code version control, repository synchronization, local commits, and remote pushes (critical for global team collaboration).
- **Terminal Enhancement Tool**: Optimizes command-line input/output, boosts operational efficiency, and ensures compatibility across global systems.
Step 1: Install Node.js Runtime Environment
Choose the LTS (Long-Term Support) version for stability—avoid bleeding-edge releases to prevent version mismatches.
Related: Configure MCP Servers
Windows Installation
- Download the LTS installer from the [official Node.js website](https://nodejs.org/en/download/).
- Run the installer and check the box: *"Add to PATH"* (automatically configures environment variables).
- Verify installation in Command Prompt (CMD) or PowerShell:
node -v # Should return v20.x.x (LTS version)
npm -v # Should return a matching npm version (e.g., 10.x.x)
macOS Installation
Use Homebrew (recommended for global developers) for seamless setup:
# Install Homebrew first (if not already installed)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Install Node.js LTS
brew install node@20
# Verify installation
node -v
npm -v
Linux Installation (Ubuntu/Debian)
# Update package list
sudo apt update
# Install Node.js LTS and npm
sudo apt install -y nodejs npm
# Verify installation
node -v
npm -v
Step 2: Install Git for Version Control
Git is mandatory for managing code across local machines and remote repositories (e.g., GitHub, GitLab)—essential for overseas team collaboration.
Related: 12 Essential Claude Code Terminal Commands
Windows Installation
- Download Git from the [official Git website](https://git-scm.com/download/win).
- Run the installer:
- Check *"Use Git from the command line"* to add Git to PATH.
- Keep default settings for other options (compatible with global development workflows).
- Verify installation:
git --version # Should return git version 2.x.x
macOS Installation
Use Homebrew for quick setup:
brew install git
# Verify installation
git --version
Linux Installation (Ubuntu/Debian)
sudo apt update
sudo apt install -y git
# Verify installation
git --version
Post-Installation Configuration (Critical for Global Teams)
Set your global Git identity to link commits to your account:
git config --global user.name "Your Full Name"
git config --global user.email "your-email@example.com" # Match your GitHub/GitLab email
Step 3: Install Terminal Enhancement Tool (Windows Terminal)
For Windows users, the default CMD/PowerShell lacks modern features. Windows Terminal (Microsoft's official tool) supports multiple tabs, Unicode, and global character sets—ideal for overseas development.
Related: ECC's Zero-Pitfall Setup Guide
Windows Installation
- Open Microsoft Store and search for *"Windows Terminal"*.
- Click *"Install"* (free, no additional configuration needed).
- Launch Windows Terminal: It automatically detects Git Bash, PowerShell, and CMD for flexible switching.
macOS/Linux Alternative
macOS Terminal and Linux Terminator are already robust. For enhanced functionality, install Oh My Zsh:
# Install Oh My Zsh (macOS/Linux)
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# Verify installation (restart terminal first)
echo $SHELL # Should return /bin/zsh
Final Verification: Ensure All Tools Work Together
Run these commands in your terminal to confirm the setup is complete:
Related: Git & GitHub Beginner's Guide
# Check Node.js and npm
node -v && npm -v
# Check Git
git --version
# Test npm package installation (verify Node.js runtime)
npm install -g hello-world-npm
hello-world-npm # Should output "Hello World!"
Troubleshooting Common Issues for Overseas Developers
- **Network Errors During Installation**: Use a regional mirror (e.g., npm Taobao mirror for APAC, npm Europe mirror for EU):
```bash
# Set npm mirror (EU example)
npm config set registry https://registry.npmjs.org/
```
- **Permission Denied (Linux/macOS)**: Add `sudo` before commands (e.g., `sudo npm install -g ...`).
- **PATH Configuration Issues**: Reinstall the tool and ensure "Add to PATH" is checked (Windows) or use `export PATH="$PATH:/usr/local/bin"` (Linux/macOS).
With these three tools installed, you're fully prepared to run Claude Code for global development projects—from local AI programming to cross-border team collaboration. Next, you can proceed to install Claude Code and start building overseas-facing applications, tools, or SaaS products.
常见问题
为什么用Claude Code需要Node.js?
Claude Code本身是Node.js应用程序。没有Node.js,claude命令无法运行。只需安装一次,之后npm也可用于安装其他工具。
一个人工作可以跳过Git吗?
技术上可以,但不推荐。Git跟踪更改、撤销错误并同步GitHub。当Claude Code做出不喜欢的更改时,Git能立即撤销。
Windows上必须用Windows Terminal吗?
不是必须的,但它支持多标签页和Unicode,改善开发体验。PowerShell也能用但缺少现代功能。Mac/Linux内置终端已足够。