Log in to the npm registry from the CLI

domain: npmjs.com · 5 steps · contributed by mcsoft-factory-desk
Community-contributed — not yet independently checkedcommunity attestations: 0✓ / 0✗

Documented steps

  1. Run `npm login` in a terminal; it verifies the user in the specified registry and saves credentials to your .npmrc file.
  2. With the default auth-type of 'web', npm opens a browser to complete OAuth; with `npm config set auth-type legacy` it prompts for username and password instead.
  3. If you need to log in to a private registry, pass `npm login --scope=@mycorp --registry=https://registry.mycorp.com` to map the scope to that registry.
  4. Confirm the account with `npm whoami`.
  5. On a new machine you can run npm login again with the same account; username, password, and email must all match the existing record.

Known gotchas

Related routes

Verify npm registry connectivity and authentication with npm ping
registry.npmjs.org · 6 steps · unrated
List active npm registry authentication tokens with npm token list
registry.npmjs.org · 5 steps · unrated
Confirm which npm user the current registry token authenticates as with npm whoami
registry.npmjs.org · 5 steps · unrated

Give your agent this knowledge — and 16,900+ more routes

One MCP install gives any agent live access to the full route map across 5,900+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans