Skip to content

fix(npm): don't fetch registry info for deprecated packages under --cached-only#35903

Merged
bartlomieju merged 2 commits into
mainfrom
fix/cached-only-deprecated-npm
Jul 15, 2026
Merged

fix(npm): don't fetch registry info for deprecated packages under --cached-only#35903
bartlomieju merged 2 commits into
mainfrom
fix/cached-only-deprecated-npm

Conversation

@bartlomieju

Copy link
Copy Markdown
Member

When an npm package is marked as deprecated in the lockfile, the installer
fetches the registry packument to obtain the deprecation message, since it
is not present in the tarball's package.json. Under --cached-only, or
whenever the packument was never cached, this fetch fails with "npm package
not found in cache" and aborts the whole run, even though node_modules is
fully populated and the deprecation message is only informational.

This makes the deprecated-package path fall back to reading the extra info
from the package's on-disk package.json when the registry fetch fails,
skipping the (cosmetic) deprecation warning in that case instead of failing.

Closes #35901

…ached-only

When an npm package is marked as deprecated in the lockfile, the installer
fetched the registry packument to obtain the deprecation message, since it
is not present in the package's package.json. Under --cached-only (or when
the packument was never cached) this fetch fails with "npm package not found
in cache", causing the whole run to error even though node_modules is fully
populated and the deprecation message is only informational.

Fall back to reading the extra info from the package's on-disk package.json
when the registry fetch fails, skipping the deprecation warning in that case
instead of failing.

Closes #35901
…cated pkgs

Once the registry fetch fails for a deprecated package (e.g. under
--cached-only with an uncached packument), the fallback path could still
call fetch_from_registry again for the expected.bin/directories.bin case
and in the package.json read-error arm, failing identically and aborting
the run. Track that the registry is unavailable and skip those retries.

Convert the test fixture to use directories.bin so expected.bin is true
from the server-expanded packument while the on-disk package.json read
yields bin=None, actually exercising the retry path this guards.
@bartlomieju
bartlomieju merged commit 49f5024 into main Jul 15, 2026
136 checks passed
@bartlomieju
bartlomieju deleted the fix/cached-only-deprecated-npm branch July 15, 2026 10:00
bartlomieju added a commit that referenced this pull request Jul 15, 2026
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.

deno run --cached-only fails at startup when deno.lock contains packages marked "deprecated": true

1 participant