engines field declares node >=18.0.0 but code requires Node.js 20+ (Symbol.dispose)
Summary
Claude Code's package.json declares engines: { node: ">=18.0.0" }, but the bundled code uses Explicit Resource Management (using declarations / Symbol.dispose) which requires Node.js 20+. This causes a cryptic runtime error on Node.js 18.x with no prior warning during installation.
Steps to reproduce
- Install Node.js v18.16.0 (or any 18.x)
npm install -g @anthropic-ai/claude-code@latest- Run
claude
Expected behavior
Either:
npm installwarns that the Node.js version is incompatible (ifenginesis updated to>=20.0.0)- Or the code works on Node.js 18.x
Actual behavior
Crashes immediately with:
TypeError: Object not disposable
at hY (file:///.../cli.js:8:1213)
at Object.existsSync (file:///.../cli.js:9:208)
Root cause
The bundled cli.js contains a polyfill for Symbol.dispose:
var XEq = Symbol.dispose || Symbol.for("Symbol.dispose")
On Node.js 18.x, Symbol.dispose is undefined, so it falls back to Symbol.for("Symbol.dispose"). However, Node.js built-in objects (e.g. file handles from fs/promises) don't implement this polyfill symbol — they only support the native Symbol.dispose, introduced in Node.js 20+.
Suggested fix
Update engines in package.json to "node": ">=20.0.0".
Environment
- OS: Ubuntu Linux (kernel 6.8.0-85-generic)
- Node.js: v18.16.0 (failing), v24.13.1 (working)
- Claude Code: latest (
@anthropic-ai/claude-code@latest)
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗