Skip to content
Nilay Kabariya

Entry No.036·Agents·Updated ·5 min read

Fix: Claude Code "not compatible with the version of Windows"

Windows says claude.exe won't run right after an npm install of Claude Code. Your Windows is fine. Reproduced on npm 12, with the reinstall that fixed it.

What changed on Nov 8, 2026: Added an npm 11 vs 12 × Node 24 vs 26 matrix and a warning about the allow-scripts line causing EALLOWSCRIPTS.

by Nilay#claude-code#npm#windowsAGENTS

The error, verbatim

Jump to the fix ↓
This version of C:\...\claude-code\bin\claude.exe is not compatible with the version of Windows you're running. Check your computer's system information and then contact the software publisher.

# PowerShell says it differently:
Program 'claude.exe' failed to run: The specified executable is not a valid application for this OS platform.
✓ Reproduced on Windows 11 Pro; Windows Server 2025 (GitHub Actions)

The fix that worked

Reinstall and let its install script run:

npm install -g @anthropic-ai/claude-code --allow-scripts=@anthropic-ai/claude-code
Not it? Every cause, tested ↓

Tested on

Claude Code
2.1.289; re-tested 2.1.316 and 2.1.319
npm
12.2.0; 12.2.1; 11.21.2 and 12.2.2 (November 8)
Node
26.10.0; 26.13.0; 24.22.2 (November 8)
OS
Windows 11 Pro; Windows Server 2025 (GitHub Actions)

✓ Last re-run on GitHub Actions · see the run · all repros

Nothing is wrong with Windows, and nothing is wrong with your CPU. The claude.exe that npm put on disk isn’t a program yet. It’s a 500-byte stand-in that Claude Code’s install script is supposed to replace with the real binary, and npm 12 stopped running that script.

Why it happens

npm 12 (the current latest on npm) blocks install scripts of dependencies by default, including the postinstall of a package you install globally. The install still says it succeeded. The only sign is a warning printed after it:

added 2 packages in 16s
npm warn install-scripts 1 package had install scripts blocked because they are not covered by allowScripts:
npm warn install-scripts   @anthropic-ai/claude-code@2.1.289 (postinstall: node install.cjs)

That install.cjs is the step that swaps the placeholder for the real Windows binary. Skipped, the file stays tiny:

bin\claude.exe Size Runs?
After npm 12 install, script blocked 500 bytes No: “not compatible with the version of Windows”
After allowing the script 249,522,848 bytes Yes: 2.1.289 (Claude Code)
Same, re-tested on 2.1.316 (1 Nov) 335,469,216 bytes Yes: 2.1.316 (Claude Code)

Windows looks at 500 bytes that aren’t a valid program and reports it the only way it knows: as an incompatible app.

This is the whole failure and the fix in one run, on npm 12.2.2: the plain install blocks the postinstall script and leaves a 500-byte claude.exe, which Windows then refuses to run; allowing the script downloads the real 345 MB binary.

Terminal on a Windows Server 2025 runner with Node 26.13.0 and npm 12.2.2: npm install -g @anthropic-ai/claude-code warns that install scripts were blocked, claude.exe is 500 bytes and claude --version says it is not compatible with the version of Windows you're running; with --allow-scripts=@anthropic-ai/claude-code, claude.exe is 344,807,072 bytes and claude --version prints 2.1.319 (Claude Code).
Claude Code 2.1.319 installed twice on the same runner, November 8, 2026. Full log.

npm 11 vs npm 12, Node 24 vs 26

It’s the npm version that decides, not Node. On November 8, the same plain npm install -g @anthropic-ai/claude-code (2.1.319) on GitHub Actions windows-latest gave:

npm 11.21.2 npm 12.2.2
Node 24.22.2 344,807,072 bytes, runs 500 bytes, “not compatible”
Node 26.13.0 344,807,072 bytes, runs 500 bytes, “not compatible”

npm 11 also prints a warning, 1 package has install scripts not yet covered by allowScripts, but it still runs the script. npm 12’s warning says the scripts had install scripts blocked, and that’s the line to look for. On every one of the four, --allow-scripts and the saved allow-scripts line gave the working 2.1.319. (run)

Claude Code isn’t the only one. OpenCode ships the same kind of placeholder and fails the same way on npm 12. I tested five agents side by side in Claude Code, Codex, Gemini CLI on Windows: install tested.

The fix

Install again, allowing Claude Code’s own script this one time:

npm install -g @anthropic-ai/claude-code --allow-scripts=@anthropic-ai/claude-code

To make it stick for every future global install and update, npm’s own warning suggests saving the permission once:

npm config set allow-scripts=@anthropic-ai/claude-code --location=user

Check whether this is your problem

If you’re not sure the blocked script is the cause, look at the file size:

(Get-Item "$(npm prefix -g)\node_modules\@anthropic-ai\claude-code\bin\claude.exe").Length

Around 500 means the placeholder: use the fix above. Hundreds of millions means the real binary is there, and your problem is something else.

And check which npm you have:

npm -v

12.x blocks the script by default. Recent npm 11 releases print a similar warning but still run the script: on npm 11.19.1 the same install said has install scripts not yet covered by allowScripts, and the real 249 MB binary arrived. The word to look for is blocked.

What didn’t work

How this was tested

A portable Node 26.10.0 (checksum-verified from nodejs.org) with npm 12.2.0, installing @anthropic-ai/claude-code@2.1.289 globally into separate empty prefix folders, so the machine’s own Claude Code was never touched. The failure was run from cmd.exe and PowerShell, and both messages are copied above. Each fix was tested in its own fresh prefix: the --allow-scripts reinstall, and the saved allow-scripts setting via a separate user config file.

November 1, 2026: re-run on GitHub Actions windows-latest (Windows Server 2025) with Node 26.13.0, npm 12.2.1 and Claude Code 2.1.316. The plain global install still left the 500-byte placeholder and the same “not compatible with the version of Windows” message; --allow-scripts and the saved allow-scripts setting each gave a working 2.1.316 (Claude Code). The script and the full output are public.

— N.K., end of entry No.036

Useful? Pass it on:Post on XFollow @EmotionalMatter

Related entries

  1. No.058

    Claude Code, Codex, Gemini CLI on Windows: install tested

    All five install and start on Windows 11 with npm 11, in cmd, on Node 24 and Node 26. Two things trip people up. On a default Windows PowerShell setup all five fail with "running scripts is disabled on this system". And with npm 12, Claude Code and OpenCode install with no error but then refuse to start: "not compatible with the version of Windows you're running".

    TESTED6 minWindows
  2. No.035

    Fix: Claude Code "Invalid API key · Fix external API key"

    Invalid API key · Fix external API key, Please run /login and 401 in Claude Code: every auth message reproduced on 2.1.314, and the Windows quoting trap.

    > Invalid API key · Fix external API key

    AGENTS5 minWindows
  3. No.093

    Fix: bigint Failed to load bindings, pure JS will be used

    bigint: Failed to load bindings, pure JS will be used. Why npm 12 shows it on every install, whether it matters, and how to get the native build back.

    > bigint: Failed to load bindings, pure JS will be used (try npm run rebuild?)

    FIXED3 minWindows

tip: paste the exact error text