Skip to content

[DOCS] pnpm β‰₯ 11 ignores ${VAR} in a project .npmrc _authToken; the documented CI recipe silently sends no authΒ #1847

Closed

Description

@ruy-bot

πŸ“š Documentation

registry/tokens.mdx ("Using tokens in CI") and the Quick Start pnpm tab recommend committing a project-level .npmrc that references the token through an environment variable:

@acme:registry=https://registry.vlt.io/acme/main/
//registry.vlt.io/acme/main/:_authToken=${NPM_TOKEN}

Problem

pnpm 11 stopped expanding environment variables in registry credential values read from a project-level .npmrc (pnpm 11 changelog: "Stopped expanding environment variables in ... registry credential values from .npmrc"). Reproduced against a local logging registry with //127.0.0.1:4899/acme/npm/:_authToken=${VLT_TOKEN} in the project .npmrc:

pnpm result
10.30 Authorization: Bearer envtok (works)
11.24 key dropped, [WARN] Ignored project-level auth setting
12.4 key dropped silently, request sent unauthenticated β†’ 401

Literal tokens in a project .npmrc are still accepted, which is why the reporting user ended up generating an .npmrc with the raw token in CI before every install β€” the opposite of what the docs intend.

Working alternatives verified on pnpm 12.4:

  • user-level ~/.npmrc with //registry.vlt.io/acme/npm/:_authToken=${VLT_TOKEN} (env expansion still works at user level);
  • npm_config_//registry.vlt.io/acme/npm/:_authToken=<token> as an env var (pnpm's own changelog warns that GitHub Actions / bash cannot set env names containing /, : or ., so this is awkward in practice);
  • PNPM_CONFIG_NPMRC_AUTH_FILE=<path> pointing at a non-committed auth file;
  • pnpm_config__auth (JSON) is pnpm's intended CI mechanism but its exact shape needs to be confirmed against pnpm docs before we recommend it.

npm 11 still expands ${VAR} in a project .npmrc (and sends the literal string Bearer ${VLT_TOKEN} when the var is unset, which is a separate foot-gun worth a sentence).

Proposed change

In tokens.mdx and the Quick Start pnpm tab:

  • state that the ${VAR} form in a committed project .npmrc works for npm but not for pnpm β‰₯ 11;
  • give pnpm users a working CI recipe (user-level .npmrc written by the CI job, or PNPM_CONFIG_NPMRC_AUTH_FILE);
  • warn against committing / generating literal tokens in the project .npmrc.

Source: end-user feedback triage of a pnpm monorepo migration to registry.vlt.io (2026-09-11).

Activity

  1. added
    documentation
    on Sep 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationregistry

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions