Claude Code Installation & Setup Guide for Windows: Node.js, Auth, Shell & CLAUDE.md Configuration
Claude Code Installation & Setup Guide for Windows Developers
Claude Code is Anthropic’s agentic AI coding tool that operates directly in your terminal. It understands your entire codebase, executes commands, edits files, and manages complex software engineering workflows. This guide walks you through a complete Windows installation, from Node.js prerequisites to advanced project configuration with CLAUDE.md.
Prerequisites
Before installing Claude Code, ensure your Windows environment meets these requirements:
- Node.js 18+ (LTS recommended)- npm 9+ (ships with Node.js)- Git for Windows with Git Bash- Windows 10/11 (64-bit)- An Anthropic API key or a Claude Pro/Max subscription
Step 1: Install and Configure Node.js
Download the latest LTS version of Node.js from the official website and run the installer. After installation, verify your setup:
node —version
npm —version
You should see version numbers for both. If Node.js is not recognized, add it to your system PATH manually:
# Add to your shell profile (~/.bashrc for Git Bash)
export PATH=“/c/Program Files/nodejs:$PATH”
Ensure npm is up to date:
npm install -g npm@latest
Step 2: Install Claude Code
Install Claude Code globally via npm:
npm install -g @anthropic-ai/claude-code
Verify the installation:
claude --version
If you encounter permission errors on Windows, run your terminal as Administrator or configure npm to use a different global directory:
npm config set prefix "$HOME/.npm-global"
export PATH="$HOME/.npm-global/bin:$PATH"
## Step 3: Authenticate Claude Code
Claude Code supports two authentication methods. Choose the one that matches your setup:
Option A: Anthropic API Key
Set your API key as an environment variable:
# In ~/.bashrc or ~/.bash_profile
export ANTHROPIC_API_KEY=“YOUR_API_KEY”
Then reload your shell:
source ~/.bashrc
Option B: Claude Pro/Max Subscription
Launch Claude Code and follow the interactive OAuth flow:
claude
This opens a browser window where you sign in with your Anthropic account. The authentication token is stored locally at ~/.claude/ and refreshes automatically.
Step 4: Shell Integration
Claude Code works best with Git Bash on Windows. Configure your shell for an optimal experience:
# Add to ~/.bashrc
Claude Code shell integration
eval ”$(claude shell-setup)“
This enables features like:
- Tab completion for Claude Code commands- Inline suggestions via
Ctrl+Kin supported terminals- Command history integration with your shellFor PowerShell users, add the following to your$PROFILE:# PowerShell profile claude shell-setup —shell powershell | Invoke-Expression
Step 5: Create Your CLAUDE.md Project Instructions
CLAUDE.md is a special configuration file that gives Claude Code persistent context about your project. Place it in your project root:
# Create CLAUDE.md in your project root
touch CLAUDE.md
Here is a practical CLAUDE.md template:
# Project Instructions for Claude Code
Tech Stack
- Frontend: React 18 + TypeScript
- Backend: Node.js + Express
- Database: PostgreSQL
- Package Manager: npm
Code Conventions
- Use TypeScript strict mode
- Prefer functional components with hooks
- Use named exports, not default exports
- Run
npm run lint before committing
Project Structure
- /src/components — React components
- /src/api — Express route handlers
- /src/utils — Shared utilities
- /tests — Test files mirroring src structure
Testing
- Framework: Vitest
- Run tests:
npm test
- Always write tests for new features
Common Commands
npm run dev— Start development servernpm run build— Production buildnpm run db:migrate— Run database migrations
CLAUDE.md Hierarchy
Claude Code reads CLAUDE.md files at multiple levels, with more specific files taking precedence:
| Location | Scope | Use Case |
|---|---|---|
~/.claude/CLAUDE.md | Global (all projects) | Personal preferences, auth info, global tools |
./CLAUDE.md | Project root | Stack, conventions, team standards |
./src/CLAUDE.md | Subdirectory | Module-specific instructions |
cd /c/Users/yourname/projects/my-app
claudeTry these common workflows:
# Ask Claude to understand your codebase
> Explain the authentication flow in this project
Fix a bug
Fix the race condition in src/api/users.ts
Add a feature
Add pagination to the /api/products endpoint with limit and offset params
Run in non-interactive mode
claude -p “Write unit tests for src/utils/validation.ts”
Pro Tips for Power Users
- Use
/compactduring long sessions to compress conversation context and avoid hitting token limits.- Useclaude -pfor non-interactive, scriptable commands in CI/CD pipelines or automation scripts.- Permission modes: Useclaude —allowedToolsto pre-approve specific tools (e.g.,Edit,Bash) for hands-free operation.- Multi-file edits: Claude Code can edit multiple files in a single turn. Describe the full scope of your change and let it work across files.- Git-aware workflows: Claude reads your git history and status. Ask it to write commit messages, review diffs, or create pull request descriptions.- Custom slash commands: Create reusable prompts in.claude/commands/as markdown files to standardize team workflows.
Troubleshooting Common Errors
| Error | Cause | Solution |
|---|---|---|
claude: command not found | npm global bin not in PATH | Run npm bin -g and add the output path to your PATH variable |
ANTHROPIC_API_KEY not set | Missing environment variable | Add export ANTHROPIC_API_KEY="YOUR_API_KEY" to ~/.bashrc and run source ~/.bashrc |
EACCES permission denied | npm global install permission issue | Reconfigure npm prefix: npm config set prefix "$HOME/.npm-global" |
Node.js version too old | Node.js below v18 | Install Node.js LTS from the official website or use nvm to manage versions |
| Shell integration not working | Profile not sourced | Restart your terminal or run source ~/.bashrc after adding shell setup |
| OAuth login fails in browser | Firewall or proxy blocking localhost callback | Temporarily disable VPN/proxy, or use API key authentication instead |
Can I use Claude Code with PowerShell instead of Git Bash on Windows?
Yes. Claude Code supports PowerShell on Windows. However, Git Bash is recommended because Claude Code uses Unix shell syntax by default. If you prefer PowerShell, add shell integration via claude shell-setup --shell powershell | Invoke-Expression in your PowerShell profile. Be aware that some commands may require syntax adjustments, such as escaping JSON strings with backslashes in PowerShell.
Does CLAUDE.md get committed to version control, and is it safe to do so?
Yes, placing CLAUDE.md in your project root and committing it to version control is the recommended practice. It allows your entire team to share consistent Claude Code instructions. Avoid putting sensitive information like API keys or secrets in CLAUDE.md. For personal preferences or credentials, use the global file at ~/.claude/CLAUDE.md, which is not part of any repository.
How do I update Claude Code to the latest version?
Run the same npm global install command to update: npm install -g @anthropic-ai/claude-code. This overwrites the existing installation with the latest release. You can check your current version with claude —version and compare it against the latest release on npm. Claude Code also notifies you in-terminal when a new version is available.