feat: warn instead of error on unknown .npmrc configs#9729
Merged
Conversation
Unknown configuration keys in .npmrc files now emit a warning by default, restoring pre-npm-12 behavior, instead of throwing. This reverts the breaking change from 979518d (#9276) for file-based configs. The new `strict-npmrc` config (default false) opts back into treating them as a hard error. Unknown CLI flags and abbreviations continue to error regardless of this setting. The warning flows through the normal display pipeline, so it respects loglevel suppression (e.g. --loglevel=error, --silent). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
408cc0d to
618679d
Compare
nishantms
approved these changes
Jul 7, 2026
ljharb
reviewed
Jul 8, 2026
Comment on lines
+395
to
+396
| `Unknown ${u.where} config ${display}. This will stop working in the ` + | ||
| 'next major version of npm. See `npm help npmrc` for supported config options.') |
Contributor
There was a problem hiding this comment.
i'd suggest wording this differently, since i suspect making this behavior default will forever be too breaking to ever successfully ship.
Contributor
Author
There was a problem hiding this comment.
I agree, but i'm gonna keep this as it was before the major.
Contributor
There was a problem hiding this comment.
Fair enough :-) either way super grateful yall are reverting this one for 12.
martinrrm
approved these changes
Jul 8, 2026
kchindam-infy
approved these changes
Jul 8, 2026
reggi
added a commit
that referenced
this pull request
Jul 8, 2026
## What / Why #9729 reverts the `.npmrc` file-config half of the breaking change from `979518d` (#9276): unknown `.npmrc` configs warn by default again, and the new `strict-npmrc` config opts back into erroring. Unknown CLI flags and abbreviations still throw. The `12.0.0-pre.1` changelog entry still carried the original wording, which claimed unknown `.npmrc` configs now throw. Since release-please aggregates every prerelease `BREAKING CHANGE` note into the eventual stable `v12.0.0` release notes, that stale line would surface (inaccurately) in the 12.0.0 notes. This corrects the wording in place. ## Change Edits the single breaking-changes bullet in the `## [12.0.0-pre.1]` section: > unknown CLI flags, abbreviated flags, and single-hyphen multi-char shorthands now throw instead of warning. (Unknown `.npmrc` configs still warn by default; opt into erroring with the new `strict-npmrc` config.) ## Notes - Manual, targeted edit to an already-released, release-please-generated section — this does not disturb release-please, which derives versions from git tags + commit history and only prepends new sections. Precedent: #8298 (`chore: add contributor to changelog entry`). - Best merged alongside / after #9729 so the corrected note reflects shipped behavior. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
What / Why
Unknown configuration keys in
.npmrcfiles now emit a warning by default, restoring pre-npm-12 behavior, instead of throwing. This reverts the file-config portion of the breaking change from 979518d (#9276).Details
.npmrc(file) configs → warn by default, with the pre-npm-12 wording ("This will stop working in the next major version of npm…").strict-npmrcconfig (Boolean, defaultfalse) → opts back into treating unknown file configs as a hardEUNKNOWNCONFIGerror.--loglevel=error,--silent).Tests
strict-npmrc, cli-only errors, and loglevel suppression.docs.jsandconfig.jssnapshots for the new config option.