Claude Code Installation & Configuration Tutorial: A Complete Setup Guide from Scratch
Claude Code Installation & Configurati…
A step-by-step guide to installing and configuring Claude Code from scratch for beginners.
This tutorial walks you through the complete Claude Code setup process, from installing prerequisites like Git, Node.js, and CC Switch, to performing a global npm installation of Claude Code. It also covers obtaining and configuring API Keys, troubleshooting common issues, and setting up the VS Code plugin for a graphical interactive experience.
Introduction
Claude Code is one of the most talked-about AI programming tools today, attracting a large number of developers with its outstanding code generation and comprehension capabilities. It is an AI programming assistant developed by Anthropic, built on their proprietary Claude large language model. Anthropic was founded in 2021 by former OpenAI Research VP Dario Amodei and others, with a focus on AI safety research. Unlike competitors such as GitHub Copilot (based on OpenAI Codex) and Cursor (an AI IDE integrating multiple models), Claude Code's core advantages lie in its ultra-long context window (supporting up to 200K tokens) and exceptional code reasoning ability — it particularly excels at understanding the overall architecture of complex codebases and making cross-file modifications.
However, for many beginners, installing and configuring a command-line tool is often the first hurdle to getting started. This article provides a detailed walkthrough of the complete Claude Code installation and configuration process from scratch, covering both the command-line version and the VS Code visual version, helping you quickly set up your development environment.
Environment Preparation: Essential Tools for Installing Claude Code
Before officially installing Claude Code, you need to prepare the following foundational tools.
Git Version Control Tool
Git is the essential tool for version management and code collaboration. Head to the Git website, click the download button, and select the appropriate Windows version to download and install.
Node.js Runtime Environment
Node.js is a required runtime environment for Claude Code. It is a JavaScript runtime built on Chrome's V8 engine, enabling JavaScript to run on the server side outside of browsers. Visit the Node.js website and select the Windows version to download. It is recommended to choose the LTS (Long-Term Support) version — LTS versions typically offer a 30-month maintenance cycle, providing better stability and making them ideal as the runtime foundation for development tools.
Installing Node.js automatically includes npm (Node Package Manager), the world's largest open-source software registry, hosting over 2 million packages. Claude Code is distributed and installed through npm.
CC Switch Model Management Tool
CC Switch is a model configuration management tool primarily used for managing API Keys and switching between different model services. Its core function is to forward Claude Code's requests to different LLM API services, employing a typical API gateway pattern — the Claude Code client only needs to connect to a unified local port, while the actual model calls are proxied by CC Switch. This means users can flexibly switch between underlying models (such as DeepSeek, OpenAI, Claude's native API, etc.) without modifying Claude Code's own configuration. This decoupled design is similar to how an Nginx reverse proxy works.
Go to its official website to download the Windows version. Your browser may display a security warning during download — simply choose to keep the file.
VS Code Code Editor
VS Code is a lightweight code editor from Microsoft. We will later install the Claude plugin in it to get a visual interactive experience. Simply download and install it from the VS Code website.
Obtaining an API Key: The Prerequisite for Model Service Configuration
While waiting for tools to download, you can go ahead and obtain your API Key. An API Key is essentially an authentication token used to establish a trusted communication connection between the client and the model service. When you send a request to an AI model, the API Key is attached to the HTTP request header, allowing the server to verify the requester's identity and handle billing.
Using DeepSeek's API service as an example (configured via CC Switch for routing), follow these steps:
- Open the DeepSeek website
- Click to enter the API platform
- Scan the QR code to log in
- Create a new API Key
- Important: Copy and save it to a secure location immediately after creation — you will not be able to view the Key again after closing the page
The API Key is the core credential for subsequent model configuration. Keep it safe and avoid leaking it. Industry-recommended security practices include: never hardcoding Keys in your code, storing them in environment variables, rotating Keys regularly, and creating separate Keys for different projects to achieve permission isolation. If a Key is leaked, others could misuse your quota or even access sensitive data.
Installing Claude Code and Verifying the Environment
Installing the Basic Tools
Once all tools have been downloaded, install them one by one. The installation process is straightforward — basically just click "Next" all the way through. After installation, you'll see shortcut icons for CC Switch and VS Code on your desktop.
Verifying Successful Installation
Press Win + R, type CMD, and hit Enter to open the command prompt. Enter the following commands one by one to verify the installation:
node -v
git --version
npm -v
If each command correctly outputs a version number, your base environment has been configured successfully.
Installing Claude Code Globally via npm
Enter the following command in the command prompt to install:
npm install -g @anthropic-ai/claude-code
The -g flag here means global installation, making the claude command available from any directory on your system, rather than being limited to a specific project folder. @anthropic-ai/claude-code is the official package name published by Anthropic on the npm registry.
After the installation completes, enter the following command to verify:
claude --version
If a version number is successfully output, Claude Code has been installed.
CC Switch Model Configuration and Launch Testing
Configuring CC Switch to Connect to a Model
- Type
claudein the command prompt to launch it for the first time (an initial interface will appear) - Open the CC Switch application from your desktop
- Click the plus button to add a model
- Select DeepSeek as the model service
- Paste the API Key you saved earlier into the corresponding input field
- Click Add and confirm the status shows "In Use"
Launching Claude Code for Testing
Press Win + R again, type CMD, then enter claude in the command prompt and press Enter through the prompts. Once the conversation interface appears, you can start interacting with the AI directly.
Common Issues and Solutions
Unable to Launch Claude Code in the Terminal
Some users may encounter a situation where Claude cannot be launched in the PowerShell terminal — CMD works fine, but the terminal does not. This is typically caused by environment variables or PowerShell execution policy issues. PowerShell's default execution policy (Restricted) blocks the execution of unsigned scripts, and npm globally installed commands are usually invoked through .ps1 script files.
The solution is to run a specific policy adjustment command in PowerShell to ensure Claude Code can be launched normally in both the terminal and command prompt.
npm Errors During Installation
If you encounter network timeouts or permission errors during npm installation, try the following:
- Run the command prompt with administrator privileges
- Switch the npm mirror source to improve download speed
- Check whether your Node.js version meets the minimum requirements
VS Code Visual Configuration: A Graphical Interactive Experience
For users who are not comfortable with command-line operations, the VS Code plugin version provides a more user-friendly graphical interface. VS Code's plugin system is built on the Extension API with a process-isolated architecture — each plugin runs in an independent Extension Host process, so even if a plugin crashes, it won't affect the stability of the editor's main process. The official Claude plugin achieves deep integration with the editor through the Language Server Protocol (LSP) and VS Code's Webview API, providing both direct access to the workspace file system and a graphical conversation interface.
Installing the Chinese Language Pack
- Open VS Code
- Click the plugin icon on the left sidebar (shortcut
Ctrl + Shift + X) - Search for and install the Chinese language pack
- Restart VS Code to complete the localization
Installing the Official Claude Plugin
- Create a working folder on your desktop
- Open the folder in VS Code and click "Trust"
- Go to the Extensions Marketplace and search for Claude
- Select the plugin officially published by Anthropic and install it
- After installation, a chat button will appear in the upper right corner
Practical Usage Demo
Click the chat button in the upper right corner to start interacting with Claude. For example, you can enter the following prompt:
"Write an HTML file for a basic Claude Code usage tutorial and place it in the current directory"
After the process completes, the file will be automatically generated in your working directory, and you can preview it directly in your browser.
Summary: Recap of Core Claude Code Installation & Configuration Steps
The entire Claude Code installation and configuration process is not complicated. The core steps can be summarized in four stages:
- Install the base environment — Git and Node.js
- Global npm installation — Install via
npm install -g @anthropic-ai/claude-code - Configure the model service — Use CC Switch to set up the API Key and model
- Optional graphical experience — Install the VS Code plugin for a visual interactive interface
For developers, the command-line version is more efficient and flexible. For beginners or users who prefer visual operations, the VS Code plugin version offers a lower barrier to entry. Regardless of which approach you choose, Claude Code can effectively boost your coding efficiency and development experience.
Related articles

Claude Code for Test Development in Practice: An AI Programming Workflow That Doubles Your Efficiency
A practical guide to Claude Code for test development: auto-generating test scripts, Plan Mode workflows, MCP + Playwright integration, and Subagent parallel tasks to build systematic AI-assisted workflows.

Hermes Agent Hands-On Review: An AI Efficiency Revolution for Indie Game Developers
Indie game developer reviews Hermes Agent vs OpenClaude: intelligent context compression, real-time Memory, remote control via Telegram, and practical use cases in game dev, social media, and email.

Vibe Coding Beginner's Guide: Tool Selection Across Three Categories with Practical Examples
A comprehensive guide to Vibe Coding's three tool categories: Agent frameworks, CLI Coding, and IDE tools, with practical examples including Snake game and data analysis workbench.