2025-04-10 14:36:22 -07:00
.TH "NPM-LOGOUT" "1" "April 2025" "NPM@11.3.0" ""
2015-02-20 09:03:34 -08:00
.SH "NAME"
2022-12-06 22:18:33 -05:00
\fB npm-logout\fR - Log out of the registry
.SS "Synopsis"
2015-02-20 09:03:34 -08:00
.P
.RS 2
.nf
2022-02-24 21:41:49 +00:00
npm logout
2015-02-20 09:03:34 -08:00
.fi
.RE
2021-03-23 14:58:11 -04:00
.P
2022-12-06 22:18:33 -05:00
Note: This command is unaware of workspaces.
.SS "Description"
2015-02-20 09:03:34 -08:00
.P
2022-12-06 22:18:33 -05:00
When logged into a registry that supports token-based authentication, tell the server to end this token's session. This will invalidate the token everywhere you're using it, not just for the current environment.
2015-02-20 09:03:34 -08:00
.P
2022-12-06 22:18:33 -05:00
When logged into a legacy registry that uses username and password authentication, this will clear the credentials in your user configuration. In this case, it will \fI only\fR affect the current environment.
2015-02-20 09:03:34 -08:00
.P
2022-12-06 22:18:33 -05:00
If \fB --scope\fR is provided, this will find the credentials for the registry connected to that scope, if set.
.SS "Configuration"
.SS "\fBregistry\fR"
2021-05-20 15:54:50 -04:00
.RS 0
2022-12-06 22:18:33 -05:00
.IP \(bu 4
Default: "https://registry.npmjs.org/"
.IP \(bu 4
2021-05-20 15:54:50 -04:00
Type: URL
2022-12-06 22:18:33 -05:00
.RE 0
2021-05-20 15:54:50 -04:00
.P
2022-12-06 22:18:33 -05:00
The base URL of the npm registry.
.SS "\fBscope\fR"
2021-05-20 15:54:50 -04:00
.RS 0
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2021-05-20 15:54:50 -04:00
Default: the scope of the current project, if any, or ""
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2021-05-20 15:54:50 -04:00
Type: String
2022-12-06 22:18:33 -05:00
.RE 0
2021-05-20 15:54:50 -04:00
2015-02-20 09:03:34 -08:00
.P
2022-12-06 22:18:33 -05:00
Associate an operation with a scope for a scoped registry.
2015-02-20 09:03:34 -08:00
.P
2021-05-20 15:54:50 -04:00
Useful when logging in to or out of a private registry:
2015-02-20 09:03:34 -08:00
.P
2021-05-20 15:54:50 -04:00
.RS 2
.nf
# log in, linking the scope to the custom registry
2022-12-06 22:18:33 -05:00
npm login --scope=@mycorp --registry=https://registry.mycorp.com
2021-05-20 15:54:50 -04:00
# log out, removing the link and the auth token
2022-12-06 22:18:33 -05:00
npm logout --scope=@mycorp
2021-05-20 15:54:50 -04:00
.fi
.RE
2015-02-20 09:03:34 -08:00
.P
2022-12-06 22:18:33 -05:00
This will cause \fB @mycorp\fR to be mapped to the registry for future installation of packages specified according to the pattern \fB @mycorp/package\fR .
2021-05-20 15:54:50 -04:00
.P
2022-12-06 22:18:33 -05:00
This will also cause \fB npm init\fR to create a scoped package.
2015-02-20 09:03:34 -08:00
.P
.RS 2
.nf
2021-05-20 15:54:50 -04:00
# accept all defaults, and create a package named "@foo/whatever",
# instead of just named "whatever"
2022-12-06 22:18:33 -05:00
npm init --scope=@foo --yes
2015-02-20 09:03:34 -08:00
.fi
.RE
2022-12-06 22:18:33 -05:00
.SS "See Also"
2015-02-20 09:03:34 -08:00
.RS 0
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2019-11-18 21:01:39 +02:00
npm help adduser
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2019-11-05 14:55:08 -05:00
npm help registry
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2019-11-18 21:01:39 +02:00
npm help config
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2019-11-18 21:01:39 +02:00
npm help whoami
2022-12-06 22:18:33 -05:00
.RE 0