Skip to content

pnpm config set inconsistently installs config dependencies #10684

@oskarols

Description

@oskarols

Verify latest release

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

pnpm version

No response

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

CLI

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

No response

Reproduction steps

  • Install a config dependency stored in a private NPM registry.
  • Remove the global (local) authentication credentials.
  • Try to do a pnpm config set to add the auth credentials again.

The pnpm config set triggers a fetch for the private config dependency, which fails with 401.

Describe the Bug

We have an internal shared pnpm config dependency, which we keep on our organizations Github registry.

We run into problems in CI when we try to set the authentication credentials using pnpm config set.

Depending on the flags sometimes pnpm will decide to immediately fetch the config dependency, before the pnpm config set has completed. This fails with a 401 error (since we haven't configured the auth credentials yet).
Whether it fetches the config dependency depends on the flags however:

pnpm config set //npm.pkg.github.com/:_authToken="$GH_TOKEN" ⛔ (401)
pnpm config set --location=project //npm.pkg.github.com/:_authToken="$GH_TOKEN" ⛔ (401)
pnpm config set --global //npm.pkg.github.com/:_authToken="$GH_TOKEN"

Expected Behavior

Ideally the failures would at least be consistent here, but preferably pnpm would not fetch the config dependency or at least have some sort of way of opting out of it.

Which Node.js version are you using?

22.x

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions