Skip to content
Nilay Kabariya

Entry No.038·Agents··3 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.

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

Tested on

Claude Code
2.1.289
npm
12.2.0
Node
26.10.0
OS
Windows 11 Pro
Contents
  1. Why it happens01
  2. The fix02
  3. Check whether this is your problem03
  4. What didn’t work04
  5. How this was tested05

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)

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

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.

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

Useful? Pass it on:Post on XFollow @EmotionalMatter

Related entries

  1. No.037

    Fix: Claude Code "Invalid API key" and "Please run /login"

    A bad key can freeze Claude Code for 3 minutes before it errors. Every auth message reproduced, the Windows quoting trap, and what auth status hides.

    > Invalid API key · Fix external API key

    AGENTS4 min
  2. No.042

    Fix: "Could not locate the bindings file" in sqlite3

    sqlite3 or better-sqlite3 installed fine, then can't find its .node file. Four causes reproduced, how the Tried: paths tell them apart, and the fix for each.

    > Error: Could not locate the bindings file. Tried:

    FIXED3 min
  3. No.040

    Fix: Puppeteer "Could not find Chrome (ver. …)"

    Puppeteer can't find Chrome though npm install worked. Six causes reproduced on Windows and Linux, including npm 12, upgrades and Docker, each with its fix.

    > Error: Could not find Chrome (ver. 154.0.8037.57). This can occur if either

    FIXED5 min

Post card · Newsletter

Get the next fix in your inbox.

One short email when a new entry is published. No spam, never shared, and you can leave any time.

— Nilay

or follow by RSSor on X

By subscribing you agree to the privacy note. One click to leave.

tip: paste the exact error text