-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Closed
Labels
Bugthing that needs fixingthing that needs fixingNeeds Triageneeds review for next stepsneeds review for next stepsRelease 8.xwork is associated with a specific npm 8 releasework is associated with a specific npm 8 release
Description
Is there an existing issue for this?
- I have searched the existing issues
This issue exists in the latest npm version
- I am using the latest npm
Current Behavior
npm whoami
undefined
Lines 12 to 21 in dc8e6bd
// 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
Metadata
Metadata
Assignees
Labels
Bugthing that needs fixingthing that needs fixingNeeds Triageneeds review for next stepsneeds review for next stepsRelease 8.xwork is associated with a specific npm 8 releasework is associated with a specific npm 8 release