Repository navigation
fix(@angular/cli): handle modern yarn registry error output and 404 detection - #34606
Merged
alan-agius4 merged 2 commits intoOct 30, 2026
Merged
Conversation
…etection
Modern yarn (v2+) reports registry errors as JSON lines on `stdout`, one per
message line, such as `{"type":"error","displayName":"YN0035","data":"Package
not found"}` followed by a `Response Code: 404 (Not Found)` line. Because
`parseNpmLikeError` did not recognize this format, querying a package that does
not exist under modern yarn threw the original `Process exited with code 1.`
error instead of returning `null`.
Add a `parseYarnModernError` parser for the modern yarn descriptor that reads
these JSON lines and returns the HTTP status as the error code, so not-found
responses are normalized to `E404`.
There was a problem hiding this comment.
Code Review
This pull request introduces a new parseYarnModernError parser to extract structured error information from modern Yarn (v2+) output, mapping registry errors to standardized error codes (e.g., E404). It also updates the package manager descriptor and adds comprehensive unit tests. The review feedback suggests two improvements: filtering out empty strings when constructing the error detail to prevent returning a string of newlines, and optimizing the status code search loop to avoid unnecessary allocations and short-circuit early.
clydin
approved these changes
Oct 30, 2026
Collaborator
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.
Modern yarn (v2+) reports registry errors as JSON lines on
stdout, one per message line, such as{"type":"error","displayName":"YN0035","data":"Package not found"}followed by aResponse Code: 404 (Not Found)line. BecauseparseNpmLikeErrordid not recognize this format, querying a package that does not exist under modern yarn threw the originalProcess exited with code 1.error instead of returningnull.Add a
parseYarnModernErrorparser for the modern yarn descriptor that reads these JSON lines and returns the HTTP status as the error code, so not-found responses are normalized toE404.