Skip to content

FIX: dont crash on startup on Node versions without std - #4098

Open
scott-huberty wants to merge 2 commits into
MoonshotAI:mainfrom
scott-huberty:fix/node-23-startup-crash
Open

scott-huberty wants to merge 2 commits into
MoonshotAI:mainfrom
scott-huberty:fix/node-23-startup-crash

Conversation

@scott-huberty

@scott-huberty scott-huberty commented Oct 1, 2026 •

Copy link
Copy Markdown

Requirement or Bug

#4097

Bug Reproduction Steps

  1. Use Node 23.0–23.7 (reproduced on v23.6.0). This is inside the published engines range >=22.19.0.
  2. npm install -g @moonshot-ai/kimi-code. The install succeeds.
  3. Run kimi. It crashes immediately:
import zlib, { createZstdDecompress, gzip } from "node:zlib";
               ^^^^^^^^^^^^^^^^^^^^
SyntaxError: The requested module 'node:zlib' does not provide an export named 'createZstdDecompress'

Root Cause

Node added zlib.createZstdDecompress in v23.8.0 and backported it to v22.15.0 (LTS). So every 22.x from 22.15 on has it, but 23.0–23.7 don't. The package's engines (>=22.19.0) still accepts 23.0–23.7:

"node": ">=22.19.0"

by the looks of it,apps/kimi-code/src/cli/update/native-stage.ts is meant to handle runtimes without zstd:

if (compressed !== undefined && typeof createZstdDecompress === 'function') {

But createZstdDecompress is imported at the top of the file, so on 23.0–23.7 this causes an error..

Code Changes

Replace the named import of createZstdDecompress with a default zlib import, so a runtime that lacks zstd proceeds through to the existing fallback instead of failing when the module loads.

Behavior Changes and Affected Users

Behavior Before After Who relies on the old behavior Escape hatch
kimi startup on Node 23.0–23.7 Crashes with SyntaxError Starts normally Nobody N/A

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue (external PRs: issue must have a maintainer's /approve).
  • I have added tests that prove my feature works.
  • The behavior-change table above is complete, and every removed behavior or flipped default is named in the changeset and either has an escape hatch or was explicitly approved by a maintainer in this PR.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

@changeset-bot

changeset-bot Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: ba46744

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@scott-huberty

Copy link
Copy Markdown
Author

I did not include a regression test.. Perhaps running the tests on a CI with Node 23.6.0 will suffice?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant