Install Claude Code (Windows)

A practical, battle-tested guide to installing the Claude Code CLI on Windows, including the rough edges you are likely to hit along the way. Do this before Deployment & Usage — the toolkit’s installers assume claude is already on your PATH.

Overview

Claude Code ships as an npm package, @anthropic-ai/claude-code, and runs as a claude command in any terminal (PowerShell, cmd, or Windows Terminal). Besides the CLI, Claude Code is also available as a desktop app (Mac/Windows), a web app (claude.ai/code), and IDE extensions (VS Code, JetBrains) — but this guide covers the CLI only.

Prerequisites

Node.js

Claude Code requires Node.js 22 or newer (recent releases declare "node": ">=22.0.0"). Older Node such as 18.x may still launch the CLI, but npm will print an EBADENGINE warning and you can hit subtle runtime glitches:

npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '@anthropic-ai/claude-code@2.1.218',
npm WARN EBADENGINE   required: { node: '>=22.0.0' },
npm WARN EBADENGINE   current: { node: 'v18.13.0', npm: '8.19.3' }
npm WARN EBADENGINE }

Check what you have:

node --version
npm --version

Install or upgrade to the latest LTS (22.x) via winget:

winget install OpenJS.NodeJS.LTS

Or download the installer from https://nodejs.org and install over the top of the old version.

If you upgrade Node after installing Claude Code, reinstall the CLI so it is rebuilt against the new runtime:

npm install -g @anthropic-ai/claude-code

Installation

Install the package globally:

npm install -g @anthropic-ai/claude-code

Verify:

claude --version

Expected output (version will vary):

2.1.218 (Claude Code)

Common Windows gotchas

1. PowerShell execution policy blocks npm

By default, PowerShell may refuse to run npm because npm ships as a .ps1 script and script execution is disabled:

npm : File C:\Program Files\nodejs\npm.ps1 cannot be loaded because running
scripts is disabled on this system.
    + FullyQualifiedErrorId : UnauthorizedAccess

Fix (recommended) — allow signed/local scripts for the current user only:

Set-ExecutionPolicy -Scope CurrentUser RemoteSigned

Answer Y at the prompt. RemoteSigned is a safe level: local scripts run freely, while scripts downloaded from the internet must be signed.

Alternative (no policy change) — call the .cmd shim directly, which does not trigger the .ps1 execution-policy check:

npm.cmd install -g @anthropic-ai/claude-code

2. npm blocks the postinstall script

If your npm is configured to gate install scripts, the package installs but its postinstall step (node install.cjs) is skipped:

npm warn allow-scripts 1 package has install scripts not yet covered by allowScripts:
npm warn allow-scripts   @anthropic-ai/claude-code@2.1.218 (postinstall: node install.cjs)
npm warn allow-scripts Run `npm approve-scripts --allow-scripts-pending` to review,
npm warn allow-scripts or `npm approve-scripts <pkg>` to allow.

npm approve-scripts <pkg> operates on the current project directory, not on globally installed packages. Running it against a global install fails with:

npm error code ENOMATCH
npm error No installed packages match: @anthropic-ai/claude-code

The skipped postinstall only fine-tunes native components. The CLI still runs on its JavaScript path without it, so in most cases no action is needed. If you want the postinstall to run anyway, reinstall with scripts in the foreground:

npm install -g @anthropic-ai/claude-code --foreground-scripts

Verifying the installation

Run the built-in diagnostics:

claude doctor

This reports the installed version, component availability, and any environment problems.

First run

Open a terminal in your project folder and start Claude:

cd path\to\your\project
claude

On first launch it opens a browser to sign in to your Anthropic account. After authentication you are dropped into the interactive session.

WSL alternative

If you prefer a Linux environment on Windows, install Claude Code inside a WSL distribution. The steps are identical (npm install -g @anthropic-ai/claude-code), just run inside the WSL shell, and you avoid the PowerShell execution-policy issue entirely.

Quick reference

Task Command

Check Node / npm

node --version / npm --version

Install Node LTS

winget install OpenJS.NodeJS.LTS

Allow PowerShell scripts

Set-ExecutionPolicy -Scope CurrentUser RemoteSigned

Install Claude Code

npm install -g @anthropic-ai/claude-code

Bypass policy (one-off)

npm.cmd install -g @anthropic-ai/claude-code

Force postinstall

npm install -g @anthropic-ai/claude-code --foreground-scripts

Check version

claude --version

Diagnostics

claude doctor

Start a session

claude

Next step → Deployment & Usage to sync the toolkit’s agents & skills into ~/.claude (install.ps1 on Windows).