[BUG] Websocket constructor not found if `DEV=true` is in the environment

Status Closed — not planned
Maintainer reply None cached
Activity 8 comments · opened Jun 13, 2025 · closed Jan 15, 2026

Environment

  • Platform (select one):
  • [x] Anthropic API
  • [ ] AWS Bedrock
  • [ ] Google Vertex AI
  • [ ] Other: <!-- specify -->
  • Claude CLI version: 1.0.22 (Claude Code)
  • Operating System: Manjaro Linux 25.0.3
  • Terminal: WezTerm

Bug Description

When the environment variable DEV is set to a non-falsy value, claude results in the following error on startup:

$ claude
╭──────────────────────────╮
│ ✻ Welcome to Claude Code │
╰──────────────────────────╯

file:///home/redacted/file/path/node_modules/@anthropic-ai/claude-code/cli.js:227

# ... minified stacktrace

TypeError: window.WebSocket is not a constructor
    at Module.Q01 (file:///home/redacted/file/path/node_modules/@anthropic-ai/claude-code/cli.js:227:20201)
    at file:///home/redacted/file/path/node_modules/@anthropic-ai/claude-code/cli.js:227:22891
    at file:///home/redacted/file/path/node_modules/@anthropic-ai/claude-code/cli.js:7:570
    at file:///home/redacted/file/path/node_modules/@anthropic-ai/claude-code/cli.js:674:8873

Node.js v24.2.0

Calling claude with DEV=false results in it starting up correctly.

Steps to Reproduce

  1. export DEV=true
  2. claude
  3. Error!
  4. export DEV=false
  5. claude
  6. Success!

Expected Behavior

It should work regardless of my local environment variables

Actual Behavior

It does not work with regards to my local environment variables

View original on GitHub ↗

8 Comments

674019130 · 1 year ago

same, and thanks for your debug, it very helps

Kolomona · 1 year ago

Confirmed on my system. Ubuntu 22.04

G2Jose · 1 year ago

This is annoying, but in case it helps anyone, just set up an alias on your shell.

Eg: with zsh

  1. find where claude is installed using which claude
  2. in your .zshrc: alias claude="DEV=false RESULT_FROM_PREVIOUS_COMMAND"
dezgit2025 · 1 year ago

can we get this fixed permemantly

github-actions[bot] · 10 months ago

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

benzntech · 10 months ago

Additional Report

Environment:

  • OS: macOS
  • Error: TypeError: window.WebSocket is not a constructor

Error Stack

TypeError: window.WebSocket is not a constructor
    at Module.uBA (file:///[...]/node_modules/@anthropic-ai/claude-code/cli.js:302:20213)
    at file:///[...]/node_modules/@anthropic-ai/claude-code/cli.js:302:22103
    at file:///[...]/node_modules/@anthropic-ai/claude-code/cli.js:8:567
    at file:///[...]/node_modules/@anthropic-ai/claude-code/cli.js:302:22825

Confirms issue is impacting macOS users with npm installations. WebSocket constructor unavailable in Node/Bun runtime - appears to be a bundling issue with browser APIs not properly polyfilled.

github-actions[bot] · 9 months ago

This issue has been automatically closed due to 60 days of inactivity. If you're still experiencing this issue, please open a new issue with updated information.

github-actions[bot] · 8 months ago

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.