claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[BUG] claude-code for Windows is NOT available due to its port

Open frkavka opened this issue 1 year ago • 19 comments

Image

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

  1. Install Claude Code on Windows: npm install -g @anthropic-ai/claude-code
  2. Run claude-code in administrator Command Prompt
  3. 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 :54545 shows 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

frkavka avatar Jul 12 '25 14:07 frkavka

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

Image

sebthom avatar Jul 12 '25 19:07 sebthom

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

Image

It works!!!But is there the potential risks of banning?

shuiguoqu avatar Jul 13 '25 00:07 shuiguoqu

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 Image

It works!!!But is there the potential risks of banning?

why i can't find the path after install

vicckuo avatar Jul 13 '25 03:07 vicckuo

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 Image

It 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

Image

shuiguoqu avatar Jul 13 '25 03:07 shuiguoqu

@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).

frkavka avatar Jul 13 '25 08:07 frkavka

Image

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!

falsharif86 avatar Jul 13 '25 09:07 falsharif86

Image 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!

@falsharif86 Great and smart! This looks more stable until the preset port is changed at least. Thank you for sharing!

frkavka avatar Jul 14 '25 00:07 frkavka

It working

Image

trevor-media avatar Jul 14 '25 05:07 trevor-media

Image 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!

this doesn't work for me :/

Kaythecreator avatar Jul 14 '25 19:07 Kaythecreator

Image 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!

This worked for me

Stay03 avatar Jul 14 '25 20:07 Stay03

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.

mattboostkit avatar Jul 15 '25 20:07 mattboostkit

We're working on addressing this - for the meantime, we recommend using the URL to sign in.

ant-kurt avatar Jul 15 '25 23:07 ant-kurt

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.

ant-kurt avatar Jul 16 '25 16:07 ant-kurt

v1.0.54 released today with this fix. Happy coding!

ant-kurt avatar Jul 17 '25 01:07 ant-kurt

Every which way I try installing Claude Code I get the version 1.0.53...

lukstafi avatar Jul 18 '25 21:07 lukstafi

1.0.53 is tagged as latest for the time being, see https://www.npmjs.com/package/@anthropic-ai/claude-code?activeTab=versions

ant-kurt avatar Jul 18 '25 21:07 ant-kurt

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]

lukstafi avatar Jul 18 '25 21:07 lukstafi

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.

github-actions[bot] avatar Jul 29 '25 16:07 github-actions[bot]