Skip to content

agent-browser and cf still blend a second npm into sessions with node-lts (follow-up to #665/#670) #751

Closed

Description

@mitodrummer

Summary

At 57dd648 (current main), a session that includes node-lts alongside agent-browser or cf gets a blended /usr/lib/node_modules/npm that cannot load. Every npm/npx call dies:

npm error Class extends value undefined is not a constructor or null
    at Object.<anonymous> (/usr/lib/node_modules/npm/node_modules/minipass-flush/index.js:5:21)
    at Object.<anonymous> (/usr/lib/node_modules/npm/node_modules/cacache/lib/content/write.js:10:15)

This is the same failure class as #665. #670 closed it for pnpm (subsetOf node ["node"]), but agent-browser and cf still import the full ../node/build.ncl, so they still contribute a second npm tree.

Observed tree (in-session)

  • npm --version → 11.17.0 (from node-lts 24.19.0)
  • /usr/lib/node_modules/npm/node_modules/minipass-flush/package.json → 1.0.6, whose index.js does const { Minipass } = require('minipass')
  • /usr/lib/node_modules/npm/node_modules/minipass-flush/node_modules/minipass/package.json → 3.3.6 (default export only; from the node package's older npm)

First-writer-wins per-file hardlinking merges the two npm installs into a tree that never existed upstream.

Repro

Project [session].packages containing node-lts + agent-browser (and/or cf), pinned at 57dd64875cef16a89619565af4ea766e3e286aa6:

min session activate --no-hooks -n repro
min session exec repro -- bash -c 'true; npx --version'   # → Class extends value undefined…

At the previous pin d2bed3122340ef6ffe9161fd21e584f4bdf0e488 the same package set gets npm 11.11.0 and the tree loads. The regression came with the node-lts 24.14.1 → 24.19.0 bump, which moved its bundled npm ahead of node's.

Impact

gominimal/webapp's session activation hook fails: scripts/dev.sh runs npx astro dev, so min session activate fails with FinalizeSession failed: activation hook … failed (Failed { code: Some(1) }). The webapp stays on d2bed31 until this is fixed.

Suggested fix

Apply #670's approach to agent-browser and cf: depend on subsetOf node ["node"] rather than the whole node package, if they only need the binary at runtime. A structural guard would also help, e.g. a composition-time check or test that fails when two closure members ship different files at the same /usr/lib/node_modules/npm path.

Metadata

Metadata

Assignees

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