Skip to content

[rush]Fix "Unknown env config" npm warnings during rush-pnpm operations#5716

Open
Copilot wants to merge 4 commits intomainfrom
copilot/investigate-fix-for-issue-5704
Open

[rush]Fix "Unknown env config" npm warnings during rush-pnpm operations#5716
Copilot wants to merge 4 commits intomainfrom
copilot/investigate-fix-for-issue-5704

Conversation

Copy link
Contributor

Copilot AI commented Mar 23, 2026

  • Investigate issue [rush] Seeing several "Unknown env config" warnings from npm while publishing packages #5704 - "Unknown env/project config" warnings from npm
  • Revert incorrect previous fix (RushPnpmCommandLineParser env vars → CLI args)
  • Identify actual root cause: RushVersionSelector.ts calls installPackageInDirectoryAsync() without filterNpmIncompatibleProperties, so when npm installs rush-lib, pnpm-specific .npmrc properties cause warnings
  • Fix: Add filterNpmIncompatibleProperties: true to RushVersionSelector.ts
  • Update change file
  • Build succeeds
  • All 599 tests pass
  • Code review - no issues with our changes (comments are about pre-existing code)
  • Security scan completed

⌨️ Start Copilot coding agent tasks without leaving your editor — available in VS Code, Visual Studio, JetBrains IDEs and Eclipse.

…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
@github-project-automation github-project-automation bot moved this to Needs triage in Bug Triage Mar 23, 2026
@iclanton iclanton marked this pull request as ready for review March 25, 2026 17:43
@iclanton iclanton changed the title Fix "Unknown env config" npm warnings during rush-pnpm operations [rush]Fix "Unknown env config" npm warnings during rush-pnpm operations Mar 25, 2026
Copilot AI and others added 2 commits March 25, 2026 17:53
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
Copilot AI requested a review from iclanton March 25, 2026 18:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Needs triage

Development

Successfully merging this pull request may close these issues.

3 participants