Skip to content

[Bug]: npm ci fails on clean checkout under npm 11 — lock file @types/node@24.13.1 does not satisfy 24.13.2 #44121

Closed as not planned

Description

@routesmith

Bug Description

npm ci fails on a fully clean checkout of main under npm 11.16.0 / node v24.2.0:

npm error code EUSAGE
npm error `npm ci` can only install packages when your package.json and package-lock.json or npm-shrinkwrap.json are in sync. Please update your lock file with `npm install` before continuing.
npm error
npm error Invalid: lock file's @types/node@24.13.1 does not satisfy @types/node@24.13.2

Every manifest in the repo declares @types/node: ^24.12.0 (ui-tui, web, apps/desktop), which 24.13.1 satisfies — so on its face the lockfile should be valid. The failure started when @types/node@24.13.2 was published (2026-06-10T22:15Z; 24.13.1 is from 2026-06-05); before that publish, the same lockfile validated cleanly on this machine.

Downstream effect: hermes update runs npm ci in its "Updating Node.js dependencies" step, which now prints this error on every update before falling back to npm install. The fallback works, but it rewrites package-lock.json, leaving every user with a dirty working tree after each update — which then triggers the updater's stash/restore path on the next update.

Related: #6716 proposes switching install.sh from npm install to npm ci on the grounds that "npm ci works out of the box" — currently it does not, so that fix depends on this one.

Steps to Reproduce

  1. git checkout main (c94e93a64), confirm git status is clean
  2. npm --version → 11.16.0; node --version → v24.2.0
  3. npm ci --dry-run
  4. EUSAGE error above (package-lock.json is lockfileVersion: 3)

Also reproduced through hermes update, which surfaces the same error mid-update before its npm install fallback.

Expected Behavior

npm ci validates the committed lockfile on a clean checkout and installs from it without modifying any committed file. A new version of a transitive dependency being published to the registry should not affect validation of an unchanged lockfile.

Actual Behavior

npm ci exits with EUSAGE / "lock file's @types/node@24.13.1 does not satisfy @types/node@24.13.2". npm install "repairs" it by rewriting package-lock.json (3 insertions, 29 deletions): bumps @types/node 24.13.1 → 24.13.2 and removes "peer": true from the esbuild platform package entries.

Affected Component

CLI (interactive chat), Setup / Installation

Messaging Platform (if gateway-related)

N/A (CLI only)

Debug Report

N/A — environment-independent repo-side issue: the committed package-lock.json fails
npm ci validation on a pristine checkout (full reproduction above). No agent/gateway
logs are involved; happy to run `hermes debug share` if it would still help.

Operating System

Ubuntu 24.04 (WSL2, Windows 11)

Python Version

3.11.15

Hermes Version

0.16.0

Root Cause Analysis (optional)

Not fully root-caused — why npm ci is sensitive to a new registry publish at all is the open question. One possible factor: the committed lockfile records "peer": true on the esbuild platform packages, which npm 11's npm install strips when it rewrites the file — suggesting the lockfile was generated with a different npm version than 11.x. If CI pins an older npm, that would also explain why CI's npm ci doesn't catch this. The reproduction stands regardless of mechanism.

Proposed Fix (optional)

Regenerate package-lock.json with a current npm (e.g. npm install --package-lock-only on npm 11) and commit it. Optionally add a CI job that runs npm ci against the latest node LTS / npm pairing to catch future drift.

Are you willing to submit a PR for this?

  • I'd like to fix this myself and submit a PR

Activity

  1. AIalliAI commented on Jun 11, 2026

    @AIalliAI

    Reproduced — taking this one. Fix incoming: regenerate package-lock.json with npm 11 so npm ci validates on a clean checkout.

  2. added
    type/bugSomething isn't working
    P2Medium — degraded but workaround exists
    comp/cliCLI entry point, hermes_cli/, setup wizard
    area/configConfig system, migrations, profiles
    dependenciesPull requests that update a dependency file
    on Jun 11, 2026
  3. zxh2010 commented on Jun 11, 2026

    @zxh2010

    Root cause found — the lockfile contains a stale nested entry that invalidates an edge, which is what forces npm to re-resolve against the registry:

    "ui-tui/node_modules/@types/node": {
      "version": "25.9.1",
      ...
    }
    

    For the hermes-tui workspace (ui-tui/), its @types/node: ^24.12.0 dev-dependency edge resolves to that nested 25.9.1 copy first (it shadows the root node_modules/@types/node@24.13.1), and 25.9.1 does not satisfy ^24.12.0. Arborist treats the edge as invalid and re-fetches the manifest, picking the newest in-range version. From the npm ci --dry-run debug log:

    silly fetch manifest @types/node@^24.12.0
    silly placeDep ROOT @types/node@24.13.2 REPLACE for: hermes-tui@0.0.1 want: ^24.12.0
    

    That's why validation is registry-dependent: the lockfile validated fine while 24.13.1 was the latest in range, and broke the moment 24.13.2 was published (no repo change involved). Verified by copying package.json + the committed lockfile + all workspace manifests into a clean temp dir with no node_modules — npm ci --dry-run fails identically, so it's independent of local state.

    One caution for the fix: a plain npm install regeneration only bumps the root entry to 24.13.2 and keeps the stale ui-tui/node_modules/@types/node entry (confirmed locally — the resulting lockfile passes npm ci today). That makes the error recur the next time @types/node publishes a release in the ^24.12.0 range. To fix it durably, the regenerated lockfile needs that nested entry gone (e.g. npm dedupe, or remove the entry and re-run npm install), so the workspace edge resolves to the root copy and validation no longer depends on registry state.

  4. m0st4f4-hub commented on Jun 11, 2026

    @m0st4f4-hub

    +1 — same root cause hits native Windows 11

    Confirming @zxh2010's analysis on Windows 11 (PowerShell, no WSL, Node v24.15.0). Without the lockfile fix, the failure surfaces during the desktop install at the tsx/esbuild postinstall validation step in the desktop workspace:

    npm error path C:\Users\<u>\AppData\Local\hermes\hermes-agent\node_modules\tsx\node_modules\esbuild
    npm error command C:\WINDOWS\system32\cmd.exe /d /s /c node install.js
    npm error throw new Error(`Expected ${JSON.stringify(packageJSON.version)} but got ${JSON.stringify(stdout)}`);
    npm error Error: Expected "0.28.0" but got "0.27.7"
    npm error     at validateBinaryVersion (...\tsx\node_modules\esbuild\install.js:137:11)
    

    The @types/node skew @zxh2010 documented (ui-tui/node_modules/@types/node@25.9.1 shadowing the root and forcing arborist to re-resolve ^24.12.0 → 24.13.2) is exactly what reaches the desktop workspace too — tsx's own pinned esbuild@0.27.7 ends up nested next to a freshly resolved esbuild@0.28.0 from the re-resolved tree, and the postinstall validator catches the mismatch.

    Windows-specific cascade (why this is critical to land)

    This bug doesn't just block first-time install — it makes the desktop unrecoverable on Windows:

    1. Fresh install-main.ps1 → fails here, no .hermes-bootstrap-complete written.
    2. User launches Hermes.exe anyway → desktop sees no marker → triggers auto-repair ([Bug]: Desktop install loop on macOS — launcher uses system python3 (3.9) instead of bundled venv, hermes_cli import fails, gateway never starts #43913 covers the root cause; PR fix(desktop): trust bundled venv install without marker (#43913) #43983 has the active-install heuristic fix).
    3. Auto-repair re-runs npm ci over the entire workspace from the GUI → hits this same lockfile bug again → fails → loop.
    4. Each loop iteration churns hundreds of MB into temp + node_modules before failing.

    For users on tight C: drives the loop becomes destructive — there's no GUI exit. I had to manually:

    With #44024 alone applied, npm ci is clean and tsx/esbuild postinstall passes. Strong +1 on landing #44024 (with the dedupe caveat @zxh2010 raised so the nested ui-tui entry doesn't reappear next time @types/node ships in the ^24.12.0 range).

    Environment

    • OS: Windows 11 (native)
    • Node: v24.15.0, npm 11
    • Hermes: origin/main 8505e9d
    • Workspace where it surfaces first: apps/desktop (via tsx → esbuild postinstall)
  5. AIalliAI commented on Jun 11, 2026

    @AIalliAI

    Follow-up: this is fixed on main as of 5e5308d34d87bb898e62934d59486528cdf24764 ("fix(node): fix @types/node version") — @types/node was bumped to ^24.13.2 in ui-tui, web, and apps/desktop and the lockfile regenerated, which removes the stale ui-tui/node_modules/@types/node@25.9.1 entry @zxh2010 identified. Verified with the same clean-room method (root + workspace manifests + committed lockfile in an empty dir, no node_modules):

    • at 8505e9d6 (pre-fix): npm ci --dry-run → EUSAGE / Invalid: lock file's @types/node@25.9.1 does not satisfy @types/node@24.13.2
    • at current main: npm ci --dry-run → resolves clean (1484 packages)

    That supersedes #44024, and addresses the recurrence caveat in practice: the out-of-range nested entry is gone, and the per-workspace nested @types/node@24.13.2 entries that remain satisfy their ^24.13.2 edges, so a new registry publish can no longer invalidate the committed lockfile.

    On the Windows report above — a few details don't match the repo, correcting for the record so nobody chases them:

    1. There is no install-main.ps1. The Windows installer is scripts/install.ps1; the string "install-main" appears nowhere in the repo.
    2. The esbuild mechanism is inverted. tsx pins esbuild ~0.28.0, and the nested node_modules/tsx/node_modules/esbuild@0.28.0 entry is committed in the lockfile — it is not "freshly resolved", and the root copy is 0.27.7, not the other way around. The @types/node edge invalidation also doesn't touch esbuild resolution at all (the placeDep log above replaces only @types/node). If the Expected "0.28.0" but got "0.27.7" postinstall failure is real, the likely cause is different: the nested tsx/node_modules/@esbuild/* platform entries carry "peer": true flags in the pre-fix lockfile, and if npm skips the nested @esbuild/win32-x64@0.28.0 binary, the nested esbuild's install.js finds the hoisted 0.27.7 binary instead. The regenerated lockfile on main strips those peer flags too, so it should clear that symptom as well — but it's a separate mechanism from the @types/node skew, not the "same root cause".
    3. tsx is a ui-tui dev path, not a desktop one. It enters the tree via ui-tui's dependencies and hoists to root node_modules/tsx; the quoted path is the root-level install, not "the desktop workspace".
    4. The [Bug]: os.execvpe() crashes with STATUS_ACCESS_VIOLATION on Windows (Python 3.14.4), breaking profile dashboard #44282 / fix(cli): skip dashboard re-exec on Windows to avoid execvpe segfault #44355 tie-in doesn't match the code. The desktop's install-validation probe deliberately runs only hermes --version — apps/desktop/electron/backend-probes.cjs documents "we intentionally avoid invoking the command with the dashboard args" — and the os.execvpe re-exec that [Bug]: os.execvpe() crashes with STATUS_ACCESS_VIOLATION on Windows (Python 3.14.4), breaking profile dashboard #44282 covers only fires for a named-profile dashboard launch, which a fresh install doesn't have. Cherry-picking fix(cli): skip dashboard re-exec on Windows to avoid execvpe segfault #44355 should not be necessary to recover a first-time Windows install.

    With main verified clean, this issue can probably be closed (the #6716 dependency noted in the report is now unblocked too).

  6. m0st4f4-hub commented on Jun 11, 2026

    @m0st4f4-hub

    @AIalliAI thanks for the detailed breakdown — corrections noted, all four points fair:

    1. Installer is scripts/install.ps1 — install-main.ps1 was a fabricated filename on my end (likely a copy-paste from a different project's bootstrap). My apologies for the noise.
    2. The esbuild mechanism is peer-flags, not @types/node cascade. You're right — the placeDep log only replaces @types/node, and the nested tsx/node_modules/esbuild@0.28.0 is committed in the pre-fix lockfile, not freshly resolved. The "peer": true flags on the nested @esbuild/* platform entries are the real cause of the Expected "0.28.0" but got "0.27.7" postinstall on Windows. Two adjacent bugs in the same lockfile, not one root cause — I conflated them.
    3. tsx hoists to root node_modules/tsx via ui-tui, not a desktop-workspace dep. The apps/desktop/... path I quoted was the root install seen during the desktop workspace's pack step, not a desktop-owned path. Misleading framing on my end.
    4. fix(cli): skip dashboard re-exec on Windows to avoid execvpe segfault #44355 isn't needed for first-install. Confirmed by re-reading apps/desktop/electron/backend-probes.cjs — the install probe is hermes --version, not hermes dashboard. The os.execvpe crash I hit was from me manually running hermes dashboard --profile <name> after the install to verify the gateway, which is a separate code path (the named-profile re-exec). That belongs entirely on [Bug]: os.execvpe() crashes with STATUS_ACCESS_VIOLATION on Windows (Python 3.14.4), breaking profile dashboard #44282 / fix(cli): skip dashboard re-exec on Windows to avoid execvpe segfault #44355, not here.

    I'll reset our local hermes-agent checkout to current main (5e5308d3 or later), drop our #44024 cherry-pick, and re-run scripts/install.ps1 clean on Windows 11 to confirm the install path is unblocked end-to-end. Will report back on this thread with the result so it can be closed with confidence.

    Thanks again for taking the time to correct the record.

  7. m0st4f4-hub commented on Jun 11, 2026

    @m0st4f4-hub

    Re-tested on current main — clean pass on Windows 11

    @AIalliAI as promised. Verified origin/main HEAD (6c752ca3a "refactor(agent): tighten SUMMARY_PREFIX wording", which has 5e5308d34 "fix(node): fix @types/node version" as ancestor) using your clean-room method on native Windows 11 — git worktree checkout with no node_modules present, then npm ci --dry-run:

    === Worktree HEAD ===
    6c752ca3a5232baa666aa6099dedae1e26484b49 refactor(agent): tighten SUMMARY_PREFIX wording and fix stale doc references
    
    === Lockfile @types/node entries (post-fix) ===
    root @types/node:    24.13.1
    ui-tui  @types/node: 24.13.2
    desktop @types/node: 24.13.2
    
    === Clean room: no node_modules anywhere ===
    OK (absent): node_modules
    OK (absent): apps\desktop\node_modules
    OK (absent): ui-tui\node_modules
    OK (absent): web\node_modules
    
    === node v24.15.0, npm 11.6.0 ===
    
    > hermes-agent@1.0.0 postinstall
    > echo '✅ Browser tools ready. Run: python run_agent.py --help'
    
    added 1484 packages in 4s
    === exit code: 0 ===
    

    Same package count you reported (1484), no EUSAGE, no Invalid: lock file's @types/node@... does not satisfy .... Plan resolves @types/node 24.13.2 cleanly through the per-workspace nested entries; the stale ui-tui/node_modules/@types/node@25.9.1 is gone from the regenerated lockfile as expected.

    So from the Windows side, #44121 is reproducibly fixed on main — no need for #44024 cherry-pick. Happy to see it closed.

    (Also confirms the recurrence concern @zxh2010 raised in the original analysis: a future ^24.13.2-range publish can't invalidate the committed lockfile because the per-workspace nested entries already pin 24.13.2.)

  8. added a commit that references this issue on Jun 14, 2026
    eb72f2d
  9. teknium1 commented on Jul 14, 2026

    @teknium1
    Collaborator

    This is an automated hermes-sweeper review. The lockfile mismatch described here has already been fixed on main.

    • Commit 5e5308d34d87f65ff60a984210492a188419a1af (fix(node): fix @types/node version) updated the workspace ranges to ^24.13.2 and replaced the invalid ui-tui/node_modules/@types/node@25.9.1 lock entry with 24.13.2.
    • Current main has since moved ui-tui/package.json:30, web/package.json:41, and apps/desktop/package.json:127 to ^22.20.0; matching nested lock entries are present at package-lock.json:213, package-lock.json:19574, and package-lock.json:19713.
    • A current-tree search found no remaining 25.9.1 entry. The issue discussion's clean-room confirmations are therefore consistent with the committed fix.
    • The fix is included in release tag v2026.6.19.
  10. added
    os/windowsNative Windows behaviour or breakage: PowerShell install, Windows paths, cmd.exe, WSL-vs-native diff
    and removed on Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium — degraded but workaround existsarea/configConfig system, migrations, profilescomp/cliCLI entry point, hermes_cli/, setup wizarddependenciesPull requests that update a dependency fileos/windowsNative Windows behaviour or breakage: PowerShell install, Windows paths, cmd.exe, WSL-vs-native diffsweeper:implemented-on-mainSweeper: behavior already present on current mainsweeper:risk-compatibilitySweeper risk: may break existing users, config, migrations, defaults, or upgradestype/bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions