Skip to content

Commit 15761c8

Browse files
Copiloticlanton
andcommitted
fix: filter npm-incompatible .npmrc properties in RushVersionSelector
When the Rush version selector uses npm to install a different version of rush-lib, the .npmrc from the repo is synced but pnpm-specific properties (like hoist, publish-branch, email, etc.) were not being filtered out. This caused npm to emit "Unknown env config" and "Unknown project config" warnings. Add filterNpmIncompatibleProperties: true to the installPackageInDirectoryAsync call in RushVersionSelector, matching the pattern already used in InstallHelpers.ensureLocalPackageManagerAsync(). Fixes #5704 Co-authored-by: iclanton <5010588+iclanton@users.noreply.github.com> Agent-Logs-Url: https://github.com/microsoft/rushstack/sessions/e3e81359-dd04-4186-979b-7a62e0a663e3
1 parent a568321 commit 15761c8

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

apps/rush/src/RushVersionSelector.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,10 @@ export class RushVersionSelector {
6262
// different implementations of the same version of the same package.
6363
// This was needed for: https://github.com/microsoft/rushstack/issues/691
6464
commonRushConfigFolder: configuration ? configuration.commonRushConfigFolder : undefined,
65-
suppressOutput: true
65+
suppressOutput: true,
66+
// Filter out npm-incompatible properties (e.g. pnpm-specific settings) from .npmrc
67+
// since this installation always uses npm regardless of the repo's package manager.
68+
filterNpmIncompatibleProperties: true
6669
});
6770

6871
console.log(`Successfully installed Rush version ${version} in ${expectedRushPath}.`);

common/changes/@microsoft/rush/fix-rush-pnpm-npm-config-warnings_2026-03-23-18-16.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"changes": [
33
{
44
"packageName": "@microsoft/rush",
5-
"comment": "Fix \"Unknown env config\" warnings from npm during rush-pnpm operations by passing pnpm configuration via CLI args instead of NPM_CONFIG_* environment variables.",
5+
"comment": "Filter npm-incompatible properties from .npmrc when installing rush-lib via npm, to eliminate spurious \"Unknown env config\" and \"Unknown project config\" warnings.",
66
"type": "none"
77
}
88
],

0 commit comments

Comments
 (0)