npm-whoami
Show the current npm username
TLDR
Display username of the currently logged-in user
Display username of the current user in the specific registry
SYNOPSIS
npm whoami
DESCRIPTION
The `npm whoami` command displays the npm username currently authenticated, or the email address if no user is logged in. It relies on the npm configuration to determine the logged-in user or email.
This command is useful for verifying which npm user is currently active, particularly in environments where multiple users might be configured or when automating npm tasks. It allows you to confirm your authentication status before publishing packages or performing other npm operations requiring authentication.
If the command returns an error, it signifies that no user is currently logged in, and you'll need to use `npm login` to authenticate.
CAVEATS
Requires an active internet connection to authenticate with the npm registry when initially logging in. If offline and not already logged in, the command will fail. It only works with the default npm registry or registries that support the same authentication methods.
EXIT STATUS
Returns 0 if successful (user is logged in), and non-zero if an error occurs (e.g., not logged in).
CONFIGURATION
The command reads the npm configuration to determine the currently authenticated user. It utilizes the `username` config, which is managed by `npm login` and `npm adduser`.