Skip to content

The installers work on npm 12, whose npm ci reads only package-lock.json - #294

Open
kevin9327 wants to merge 1 commit into
AgentSystemLabs:mainfrom
kevin9327:fix/install-npm12-lockfile
Open

kevin9327 wants to merge 1 commit into
AgentSystemLabs:mainfrom
kevin9327:fix/install-npm12-lockfile

Conversation

@kevin9327

Copy link
Copy Markdown

Fixes #278.

Why

Releases ship their dependency lockfile as npm-shrinkwrap.json (release.yml copies package-lock.json to it before npm pack). npm ci in npm 12 only accepts a package-lock.json, so with npm 12 the one-line install stops with:

npm error code EUSAGE
npm error The `npm ci` command can only install with an existing
npm error package-lock.json with lockfileVersion >= 1. ...

That's the failure in the issue (Fedora 44, Node 24.16, npm 12.0.2). I reproduced it with npm 12.2.0 against the current release tarball (v0.1.206):

npm 12.2.0 npm 11.19.0
install.sh on main ✖ EUSAGE, "npm couldn't install Agent Office's dependencies" ✔
install.sh with this change ✔ added 28 packages, installed ✔ added 28 packages, installed

(Both runs used AGENT_OFFICE_TARBALL=<downloaded v0.1.206 agent-office.tgz> AGENT_OFFICE_INSTALL_ONLY=1.)

What changed

  • install.sh: before npm ci, copy the release's npm-shrinkwrap.json to package-lock.json if the package doesn't already have one. Older npm already prefers the shrinkwrap, and the two files are identical, so they install exactly the same versions as before.
  • install.ps1: the same copy in the Windows installer.
  • tests/install.test.ts: runs install.sh against a small local release tarball whose only lockfile is npm-shrinkwrap.json. A stand-in npm on PATH behaves like npm 12 (ci fails without package-lock.json). The test checks that npm ci saw both files and that the version is installed and marked current.

This is the same approach as the earlier #284, which its author closed without it being merged. This PR adds the regression test and the npm 12 reproduction above.

Verification

  • The new test fails on main with the npm 12 error (npm error The \npm ci` command can only install with an existing package-lock.json→agent-office: npm couldn't install Agent Office's dependencies`) and passes with the change.
  • npm run typecheck: passes
  • npm test: 607 tests, 607 pass
  • npm run build: passes
  • bash -n install.sh: passes
  • End to end with a real npm 12.2.0 and npm 11.19.0 against the v0.1.206 release tarball (table above), on Linux x86_64.

Not tested: install.ps1 on Windows. I don't have PowerShell or Windows here, so that part has only been reviewed by reading it; it mirrors the bash change line for line.

Releases ship their lockfile as npm-shrinkwrap.json. npm 12's npm ci
refuses a package without a package-lock.json, so install.sh and
install.ps1 failed with EUSAGE. Copy the shrinkwrap to package-lock.json
before npm ci; older npm read the shrinkwrap first either way.

Fixes AgentSystemLabs#278
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.

install.sh fails during installation due to missing package-lock.json (npm ci error)

1 participant