LinuxCommandLibrary

npm-logout

Sign out from the npm registry

TLDR

Log out of the registry user account

$ npm logout
copy

Log out using a custom registry
$ npm logout --registry [registry_url]
copy

SYNOPSIS

npm logout [--registry=url]

PARAMETERS

--registry=url
    Specify the registry to log out from. If not specified, it defaults to the registry specified in your npm configuration (usually the official npm registry: https://registry.npmjs.org/).

DESCRIPTION

The `npm logout` command removes authentication credentials from the npm configuration, effectively logging you out of the npm registry.

This command deletes the stored authentication token, preventing you from publishing or installing private packages that require authentication. Logging out is essential when you are working on a shared machine or when you want to prevent unintended access to your npm account.

It is important to note that logging out only affects the current user and the registry configured in your npm configuration. If you have multiple users or registries configured, you will need to log out of each one individually.

CONFIGURATION

The `npm logout` command modifies the npm configuration file, typically located at `~/.npmrc`. It removes the `_authToken` key associated with the specified registry. The `_authToken` key contains the authentication token used to access the registry.

ERRORS

An error will occur if you are not currently logged in or if the registry URL is invalid. The command might fail to logout from the registry if the configured registry is not reachable.

SEE ALSO

npm login(1), npm adduser(1), npm whoami(1)

Copied to clipboard