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.
The fix that worked
Reinstall and let its install script run:
npm install -g @anthropic-ai/claude-code --allow-scripts=@anthropic-ai/claude-codeNot 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
Contents
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.

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-codeTo 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=userCheck 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