Skip to content

Node.js v18 compatibility broken with JSON import assertions #204

@xqsit94

Description

@xqsit94

Problem

The application fails to run in Zed editor (which uses Node.js v18.19.0) with a syntax error when trying to load package.json using the JSON import assertion syntax.

Error

SyntaxError: Unexpected token 'with'

This appears in Zed logs when attempting to initialize the ACP agent.

Root Cause

After updating @types/node from 24.10.1 to 25.0.0 (commit 634f1ef), the code started using the JSON import assertion syntax:

import packageJson from "../package.json" with { type: "json" }

The with keyword for import assertions is only supported in Node.js 20.10.0 and later. Zed editor bundles Node.js v18.19.0, which doesn't support this syntax.

Details

  • Affected file: /src/acp-agent.ts
  • @types/node version that introduced the issue: 25.0.0
  • Zed's Node.js version: v18.19.0
  • Minimum Node.js version supporting import assertions: v20.10.0

Impact

  • ACP agent cannot initialize in Zed editor
  • Users running Zed cannot use Claude Code ACP
  • The application is completely broken for Zed users

Suggested Fix

Use createRequire from the node:module package instead, which is compatible with Node.js v18:

import { createRequire } from "node:module";

const require = createRequire(import.meta.url);
const packageJson = require("../package.json");

This approach maintains ES module compatibility while working with Node.js v18.19.0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions