[BUG] npm view package@latest
exits with code 0 and no output if latest
tag does not exist
#6408
Closed
2 tasks done
Labels
Bug
thing that needs fixing
Needs Triage
needs review for next steps
Release 9.x
work is associated with a specific npm 9 release
Is there an existing issue for this?
I found #4029, but the issue was closed with no resolution. I am requesting a different "expected behavior" than that ticket.
This issue exists in the latest npm version
Current Behavior
If the
latest
tag does not exist,npm view package
andnpm view package@latest
will exit with code 0 and empty output.This causes problems with tools / CI flows that use
npm view
to list existing versions of a package, especially with third-party registries.Expected Behavior
I would expect an
E404
, like what happens with you reference a different tag that does not exist, likenpm view example@foobar
.Steps To Reproduce
This is a bit difficult to reproduce, because the npm registry appears to automatically create the
latest
tag for a newly published package, even if you publish to a different tag.The GitHub NPM Package Repository, however, does not do this, so it's possible to create a package that has no
latest
tag. I have created a public package that exhibits this behavior.This reproduction requires a GitHub Personal Access token configured for the
//npm.pkg.github.com/:_authToken
config setting.Environment
9.6.5
18.13.0
macOS 13.3.1 (22E261)
The text was updated successfully, but these errors were encountered: