Skip to content

ERROR  Failed to replace env in config: ${NPM_GITHUB_TOKEN} #5093

@isla-nye

Description

@isla-nye

pnpm version: 7.6.0

All pnpm tasks fail when NPM_GITHUB_TOKEN is missing in .npmrc.

We use a GitHub token to authenticate with GitHub packages. Previously, we made sure this was available as an environment variable when we ran pnpm install. However, we did not make it available in subsequent steps which do not require authentication, for example to run scripts.

.npmrc:

@xxxxx:registry=https://npm.pkg.github.com/
//npm.pkg.github.com/:_authToken=${NPM_GITHUB_TOKEN}

This has been working with pnpm versions previous to 7.6.0, but has started failing with error:

ERROR  Failed to replace env in config: ${NPM_GITHUB_TOKEN}

We've therefore pinned pnpm to 7.5.2 for now.

Expected behavior:

NPM_GITHUB_TOKEN variable is only used when authentication is needed

Actual behavior:

All pnpm commands fail with

ERROR  Failed to replace env in config: ${NPM_GITHUB_TOKEN}

Additional information:

  • Windows, macOS, or Linux?: Linux

This could be intended behaviour as of version 7.6.0, but it is tricky for multi-step Docker builds where one of the steps is to install dependencies. We do not make NPM_GITHUB_TOKEN available to subsequent steps, so would have to remove .npmrc instead from subsequent steps (which would be our approach if it were intended behaviour). It would also be helpful if this behaviour is documented, particularly if it's due to a version upgrade.

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions