Skip to content

fix: accept omitted unresolved optional packages in npm ci - #10115

Open
mvanhorn wants to merge 1 commit into
npm:latestfrom
mvanhorn:fix/10043-npm-ci-inert-optional-packages
Open

mvanhorn wants to merge 1 commit into
npm:latestfrom
mvanhorn:fix/10043-npm-ci-inert-optional-packages

Conversation

@mvanhorn

Copy link
Copy Markdown
Contributor

Before the lockfile lookup, validateLockfile now skips an ideal-tree entry when it is inert and entry.package?.version is absent. Not run locally for lib/utils/validate-lockfile.js: npm test could not run in this environment (tap is not installed).

npm ci aborts and reports that package.json and the lockfile are out of sync, listing unresolved platform-specific optional packages such as @esbuild/*, @napi-rs/*, @rollup/rollup-*, and fsevents as missing. Those entries are the optional native packages that npm install no longer writes into the lockfile. validateLockfile walks every ideal-tree entry and treats a key missing from the virtual tree as lockfile drift. Shrinkwrap.commit omits inert nodes that have no package version, and those nodes are unresolved optional dependencies, so a lockfile that correctly left them out is reported as out of sync.

npm test could not run in this environment (tap is not installed).
The targeted JavaScript check found no runner and did not execute the new validate-lockfile test.
The npm test script failed to start the suite because tap is not available.

References

Closes #10043

Before the lockfile lookup, `validateLockfile` now skips an ideal-tree
entry when it is inert and `entry.package?.version` is absent. The new
unit test passes an empty virtual tree and one inert `@example/native`
node whose package has no version, and expects an empty error list.

Fixes npm#10043
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.

[BUG] npm ci fails with architecture-related packages on lockfiles 11.17.0 and 11.16.0

2 participants