Skip to content

Commit 6277eca

Browse files
Copiloticlanton
andauthored
[rush]Fix "Unknown env config" npm warnings during rush-pnpm operations (#5716)
* fix: convert NPM_CONFIG env vars to CLI args in rush-pnpm to prevent npm warnings In RushPnpmCommandLineParser._executeAsync(), replace NPM_CONFIG_* environment variables (STORE_DIR, CACHE_DIR, STATE_DIR, WORKSPACE_DIR) with pnpm CLI arguments (--store-dir, --config.cacheDir, --config.stateDir, --config.workspaceDir). This prevents these pnpm-specific configuration values from leaking to npm when pnpm internally delegates to npm libraries (e.g. during publish operations), which caused "Unknown env config" warnings. This approach is consistent with how BaseInstallManager already passes these values via CLI args during rush install/update. Fixes #5704 Co-authored-by: iclanton <5010588+iclanton@users.noreply.github.com> Agent-Logs-Url: https://github.com/microsoft/rushstack/sessions/c306dd18-490c-4a52-a3ca-3447740f7280 * Update changefile. * revert previous RushPnpmCommandLineParser changes; fix RushVersionSelector instead Co-authored-by: iclanton <5010588+iclanton@users.noreply.github.com> Agent-Logs-Url: https://github.com/microsoft/rushstack/sessions/e3e81359-dd04-4186-979b-7a62e0a663e3 * 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 --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: iclanton <5010588+iclanton@users.noreply.github.com> Co-authored-by: Ian Clanton-Thuon <iclanton@users.noreply.github.com>
1 parent 0c89067 commit 6277eca

2 files changed

Lines changed: 14 additions & 1 deletion

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}.`);
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"changes": [
3+
{
4+
"packageName": "@microsoft/rush",
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.",
6+
"type": "none"
7+
}
8+
],
9+
"packageName": "@microsoft/rush"
10+
}

0 commit comments

Comments
 (0)