[BUG] claude-code for Windows is NOT available due to its port
Environment
- Platform (select one):
- [x] Anthropic API
- [ ] AWS Bedrock
- [ ] Google Vertex AI
- [ ] Other:
- Claude CLI version: 1.0.51
- Operating System: Windows 11
- Terminal: Command Prompt / PowerShell
Bug Description
Claude Code fails to start on Windows with OAuth error due to port 54545 conflict with Windows dynamic port range. No configuration option exists to change the port.
Steps to Reproduce
- Install Claude Code on Windows:
npm install -g @anthropic-ai/claude-code - Run
claude-codein administrator Command Prompt - Error occurs:
OAuth error: listen EACCES: permission denied 0.0.0.0:54545
Expected Behavior
Claude Code should start successfully and open OAuth authentication in browser.
Actual Behavior
Application fails with permission denied error on port 54545. Port 54545 falls within Windows dynamic port range (49152-65535) which is reserved by the system.
Additional Context
- Tested with administrator privileges
- Firewall disabled (ESET + Windows Defender)
- Confirmed port 54545 is not in use:
netstat -ano | findstr :54545shows nothing - Adjusted Windows dynamic port range:
netsh int ipv4 set dynamicport tcp start=55000 num=10000 - No configuration option found in claude.json or CLI help to specify custom port
- Need port configuration option (CLI flag, environment variable, or config file) to resolve Windows compatibility
I had this error too. you can avoid it by patching the node\bin\node_modules\@anthropic-ai\claude-code\cli.js file and replacing the 54545 with a lower port, e.g. 44545
I had this error too. you can avoid it by patching the
node\bin\node_modules\@anthropic-ai\claude-code\cli.jsfile and replacing the54545with a lower port, e.g.44545![]()
It works!!!But is there the potential risks of banning?
I had this error too. you can avoid it by patching the
node\bin\node_modules\@anthropic-ai\claude-code\cli.jsfile and replacing the54545with a lower port, e.g.44545It works!!!But is there the potential risks of banning?
why i can't find the path after install
I had this error too. you can avoid it by patching the
node\bin\node_modules\@anthropic-ai\claude-code\cli.jsfile and replacing the54545with a lower port, e.g.44545It works!!!But is there the potential risks of banning?
why i can't find the path after install
You can run "where node" in Windows cmd to check the node path
@sebthom Thank you for sharing your knowledge! This seems to be originate from the Windows port reservation; the range 49152-65535 can be secured by system. The port 54545 is out of the reserved range on my env TODAY, but your solution will get stable to use Claude Code safely(probably).
Here's a simpler solution :
Step 1: Change the dynamic port range to exclude 54545
powershell
netsh int ipv4 set dynamicport tcp start=55000 num=10000
Step 2: Verify the change was applied
powershell
netsh int ipv4 show dynamicport tcp You should see:
Protocol tcp Dynamic Port Range
Start Port : 55000 Number of Ports : 10000
Step 3: Restart your computer This is important - the port range changes require a reboot to take effect.
Step 4: After restart, try Claude Code again
The new range (55000-64999) will leave port 54545 free for Claude Code to use, which should resolve the OAuth error. If for some reason you need to revert this change later, you can restore the original settings with: powershellnetsh int ipv4 set dynamicport tcp start=49152 num=16384 Go ahead and run that first command, then restart when convenient. This should solve your Claude Code setup issue!
Here's a simpler solution :
Step 1: Change the dynamic port range to exclude 54545
powershell
netsh int ipv4 set dynamicport tcp start=55000 num=10000Step 2: Verify the change was appliedpowershell
netsh int ipv4 show dynamicport tcp You should see:
Protocol tcp Dynamic Port Range
Start Port : 55000 Number of Ports : 10000
Step 3: Restart your computer This is important - the port range changes require a reboot to take effect.
Step 4: After restart, try Claude Code again
The new range (55000-64999) will leave port 54545 free for Claude Code to use, which should resolve the OAuth error. If for some reason you need to revert this change later, you can restore the original settings with: powershellnetsh int ipv4 set dynamicport tcp start=49152 num=16384 Go ahead and run that first command, then restart when convenient. This should solve your Claude Code setup issue!
@falsharif86 Great and smart! This looks more stable until the preset port is changed at least. Thank you for sharing!
It working
Here's a simpler solution :
Step 1: Change the dynamic port range to exclude 54545
powershell
netsh int ipv4 set dynamicport tcp start=55000 num=10000Step 2: Verify the change was appliedpowershell
netsh int ipv4 show dynamicport tcp You should see:
Protocol tcp Dynamic Port Range
Start Port : 55000 Number of Ports : 10000
Step 3: Restart your computer This is important - the port range changes require a reboot to take effect.
Step 4: After restart, try Claude Code again
The new range (55000-64999) will leave port 54545 free for Claude Code to use, which should resolve the OAuth error. If for some reason you need to revert this change later, you can restore the original settings with: powershellnetsh int ipv4 set dynamicport tcp start=49152 num=16384 Go ahead and run that first command, then restart when convenient. This should solve your Claude Code setup issue!
this doesn't work for me :/
Here's a simpler solution :
Step 1: Change the dynamic port range to exclude 54545
powershell
netsh int ipv4 set dynamicport tcp start=55000 num=10000Step 2: Verify the change was appliedpowershell
netsh int ipv4 show dynamicport tcp You should see:
Protocol tcp Dynamic Port Range
Start Port : 55000 Number of Ports : 10000
Step 3: Restart your computer This is important - the port range changes require a reboot to take effect.
Step 4: After restart, try Claude Code again
The new range (55000-64999) will leave port 54545 free for Claude Code to use, which should resolve the OAuth error. If for some reason you need to revert this change later, you can restore the original settings with: powershellnetsh int ipv4 set dynamicport tcp start=49152 num=16384 Go ahead and run that first command, then restart when convenient. This should solve your Claude Code setup issue!
This worked for me
Got the same error, surely the Claude Code team know this is a thing?!?
OAuth error: Port 54545 is already in use. Please ensure no other applications are using this port.
We're working on addressing this - for the meantime, we recommend using the URL to sign in.
In upcoming version v1.0.54, we're changing Claude Code to use port 45454 (outside the dynamic range). As a mitigation, continue to use the URL to sign in.
v1.0.54 released today with this fix. Happy coding!
Every which way I try installing Claude Code I get the version 1.0.53...
1.0.53 is tagged as latest for the time being, see https://www.npmjs.com/package/@anthropic-ai/claude-code?activeTab=versions
Funny: it seems curl -fsSL claude.ai/install.sh | bash installed bun under .local\bin\claude.
The syntax to install a specific version is, for example: > npm install -g @anthropic-ai/[email protected]
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.
Here's a simpler solution :
Here's a simpler solution :
Here's a simpler solution :