You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
npm info --json array output in npm 12 breaks published-version detection in changeset publish #2164
npm 12 (12.0.0, released 2026-07-08) changed npm info <pkg> --json to wrap its output in an array, even for a single package spec:
$ npx -y npm@11 info react --json | jq 'type'"object"
$ npx -y npm@12 info react --json | jq 'type'"array"
getPackageInfo() in packages/cli/src/commands/publish/npm-utils.ts returns jsonParse(result.stdout.toString()) unmodified, and its callers read properties off the result (pkgInfo.error, pkgInfo.versions). With npm 12 those are properties of the wrapping array, so they are always undefined. As a consequence, in getUnpublishedPackages():
publishedVersions = response.pkgInfo.versions || [] is always [], so every package is treated as unpublished — the log shows X is being published because our local version (…) has not been published on npm for packages whose current version is already on the registry, and changeset publish attempts to republish all of them;
only-pre detection (response.pkgInfo.versions && versions.every(...)) never triggers;
E404 detection in infoAllow404() (pkgInfo.error?.code === "E404") also can't work.
On 2.31.0 the duplicate publish attempts then crash the whole run with TypeError: Cannot read properties of undefined (reading 'includes') at isAlreadyPublishedError (that secondary crash was fixed by #2132, thanks!) — but even with that fix, detection is still wrong and every release run re-attempts publishes of already-published versions instead of skipping them up front.
This starts happening for anyone whose CI installs npm@latest (a common pattern, e.g. for npm trusted publishing), which now resolves to 12.x.
Reproduction
In any monorepo where at least one package's current version is already published:
Observed: <pkg> is being published because our local version (x.y.z) has not been published on npm for already-published packages, followed by failed duplicate publishes. Expected: <pkg> is not being published because version x.y.z is already published on npm.
Root cause
npm 12's npm view/npm info--json output format change (results are now always emitted as an array). The data itself is unchanged — the packument object with the full versions array is the array's single element — it's just wrapped.
Activity
beeequeue commentedon Jul 15, 2026
this should be fixed in
2.23.1, it's not tagged as latest yet but you should be able to install ittuler commentedon Jul 15, 2026
fixed by #2159
chore(deps): upgrade @changesets/cli to fix npm 12 publish-check bug (#…
ci: pin release npm to 11 to dodge npm 12's array info output (#17)
ci: pin npm to 11 so changeset publish can detect published versions (#…
ci: pin cyberuni/.github reusable workflows to @v2
ci: pin cyberuni/.github reusable workflows to @v2
ci: pin cyberuni/.github reusable workflows to @v2
ci: pin cyberuni/.github reusable workflows to @v2
ci: pin cyberuni/.github reusable workflows to @v2
ci: pin cyberuni/.github reusable workflows to @v2
ci: pin cyberuni/.github reusable workflows to @v2
ci: pin cyberuni/.github reusable workflows to @v2
ci: pin cyberuni/.github reusable workflows to @v2
ci: pin cyberuni/.github reusable workflows to @v2
chore: upgrade @changesets/cli to v3 (#9)
ci: pin cyberuni/.github reusable workflows to @v2
ci: pin cyberuni/.github reusable workflows to @v2
chore: upgrade @changesets/cli to v3 (#30)
ci: pin cyberuni/.github reusable workflows to @v2 (#264)
fix: repair the release path and the package entry points it would pu…
chore(deps): upgrade @changesets/cli to v3 (#297)