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.
Tested on
- Claude Code
- 2.1.289
- npm
- 12.2.0
- Node
- 26.10.0
- OS
- Windows 11 Pro
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) |
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-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.
— N.K., end of entry No.038