Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
|
// No username, but we have other credentials; fetch the username from registry |
|
if (creds.token || creds.certfile && creds.keyfile) { |
|
const registryData = await npmFetch.json('/-/whoami', { ...opts }) |
|
return registryData.username |
|
} |
|
|
|
// At this point, even if they have a credentials object, it doesn't have a |
|
// valid token. |
|
throw Object.assign( |
|
new Error('This command requires you to be logged in.'), |
Expected Behavior
npm whoami
npm ERR! This command requires you to be logged in.
It seems to me, that there should be condition on return at line 15
if (registryData?.username) {
return registryData.username;
}
Steps To Reproduce
- Config registry=https://verdaccio.example.com
- Run 'npm whoami'
- See result
Environment
- npm: 8.19.2
- Node.js: 18.12.1
- OS Name: Windows 11
- System Model Name: Other
- npm config:
registry=https://verdaccio.example.com
Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
cli/lib/utils/get-identity.js
Lines 12 to 21 in dc8e6bd
Expected Behavior
It seems to me, that there should be condition on return at line 15
Steps To Reproduce
Environment
registry=https://verdaccio.example.com