Skip to content

pnpm v11 unsets npm_config_ environment variables #12399

Description

@felipecrs

Verify latest release

  • I verified that the issue exists in the latest pnpm release

pnpm version

11.6.0

Which area(s) of pnpm are affected? (leave empty if unsure)

No response

Link to the code that reproduces this issue or a replay of the bug

https://github.com/felipecrs/pnpm-repro-unsets-npm-config-env-vars

Reproduction steps

$ git clone https://github.com/felipecrs/pnpm-repro-unsets-npm-config-env-vars
$ cd pnpm-repro-unsets-npm-config-env-vars
$ npm_config_platform_arch=arm64 pnpm postinstall

Describe the Bug

The npm_config_ environment variables defined by the user gets unset by pnpm v11 during install scripts.

This makes it impossible to control the behavior of the install scripts that depend on it, like install-artifact-from-github (which is used by re2).

Apparently this is not the first time pnpm breaks it:

Specifically, this caused a regression in Renovate which prevents the release job from working after upgrading to pnpm v11:

renovatebot/renovate#43885 (comment)

The pnpm v11 changelog has this:

Lifecycle scripts no longer get npm_config_* env vars from the pnpm config; only well-known npm_* env vars are set, matching Yarn.

But that does not say it would unset variables set by the user, so I assume this is a bug.

Expected Behavior

If the environment variables are set by the user in the system, pnpm should not unset them.

Which Node.js version are you using?

v24.16.0

Which operating systems have you used?

  • macOS
  • Windows
  • Linux

If your OS is a Linux based, which one it is? (Include the version if relevant)

Ubuntu 26.04 LTS

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions