npm / npm/cli

[DOCS] unable to set scoped credentials via environment variable

Open
#5,477 0 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Documentation Needs Triage
Dominant language
JavaScript
Stars
10.1k
Forks
4.7k
Avg merge
2d 2h
Merged PRs (30d)
19

Description

Is there an existing issue for this?
  • I have searched the existing issues
This is a CLI Docs Problem, not another kind of Docs Problem.
  • This is a CLI Docs Problem.
Description of Problem

npm prints a warning whenever _auth is used without scoping the credential and a custom registry is configured.

$ NPM_CONFIG_REGISTRY=http://localhost:8080 NPM_CONFIG__AUTH=TOKEN npm -v

npm WARN config `_auth`, `_authToken`, `username` and `_password` must be scoped to a registry. see `npm help npmrc` for more information.
8.19.1

I can't find any way to set the scoped _auth as an environment variable. NPM_CONFIG_//localhost:8080/:_AUTH=TOKEN does not work.

My use case involves short-lived project specific credentials. I don't want to add them to global or user config because the credentials are only valid for a specific project and projects could be built in parallel, I don't want to add them to the project .npmrc because that is checked in to source control.

Potential Solution
  • Define (or document if it exists) a pattern for scoped config environment variables
  • Define (or document if it exists) a pattern for scoped command line configuration
  • Add an option to suppress this warning
  • Add a project specific but not checked in config file location
Affected URL

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the environment-variable command shown in issue #5477 and read the referenced npm help npmrc guidance. Compare the documented behavior with the requested scoped credential use case and determine which of the proposed documentation or configuration outcomes is intended. Done means the supported pattern or limitation is clearly documented, with the warning behavior explained.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
cli, documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.