np icon indicating copy to clipboard operation
np copied to clipboard

`npm whoami` fails when `.npmrc` has custom registry

Open fisker opened this issue 10 months ago • 0 comments

Description

Steps to reproduce

  1. Add custom registry to .npmrc
  2. Add publishConfig with NPM registry https://registry.npmjs.org/
  3. Run np
You must be logged in. Use `npm login` and try again.

Expected behavior

https://github.com/sindresorhus/np/blob/04dc20651316ba4697ac998bfe864cf53c776b83/source/prerequisite-tasks.js#L31 should use registry from publishConfig even it's not external registry, otherwise NPM will read .npmrc

Environment

np - 10.2.0 Node.js - 10.2.0 npm - 10.7.0 Git - git version 2.42.0.windows.2 OS - Windows 10

fisker avatar Feb 05 '25 02:02 fisker