fix(npm): don't fetch registry info for deprecated packages under --cached-only#35903
Merged
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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