reggi/overrides
@reggi/path-to-regexp
dependabot/npm_and_yarn/main/copy-to-clipboard-4.0.2
dependabot/npm_and_yarn/main/eslint-10.4.0
dependabot/npm_and_yarn/main/npmcli/eslint-config-7.0.0
dependabot/npm_and_yarn/main/proc-log-7.0.0
dependabot/npm_and_yarn/npm_and_yarn-826852524d
dependabot/npm_and_yarn/npm_and_yarn-ab9a7f4bc2
deprecate-totp-2fa
dhei/classic-tokens
gat-bypass-2fa-docs
jpg619/fix-accessibility-content-flow
jpg619/version-bump-tar-2
kartykp/gat-bypass-2fa-docs
kartykp/upgrade-path-to-regex
main
maitxn/version-bump-tar
patch-1
reggi/cache-based-on-version
reggi/dev-engines
reggi/fix-transform-prettier
reggi/overrides
update-search-sensitivity
| 1 | --- |
| 2 | title: npm-logout |
| 3 | section: 1 |
| 4 | description: Log out of the registry |
| 5 | github_repo: npm/cli |
| 6 | github_branch: latest |
| 7 | github_path: docs/lib/content/commands/npm-logout.md |
| 8 | redirect_from: |
| 9 | - /cli-commands/logout |
| 10 | - /cli-commands/npm-logout |
| 11 | - /cli-documentation/cli-commands/logout |
| 12 | - /cli-documentation/cli-commands/npm-logout |
| 13 | - /cli-documentation/commands/logout |
| 14 | - /cli-documentation/commands/npm-logout |
| 15 | - /cli-documentation/logout |
| 16 | - /cli-documentation/npm-logout |
| 17 | - /cli-documentation/v10/cli-commands/logout |
| 18 | - /cli-documentation/v10/cli-commands/npm-logout |
| 19 | - /cli-documentation/v10/commands/logout |
| 20 | - /cli-documentation/v10/commands/npm-logout |
| 21 | - /cli-documentation/v10/logout |
| 22 | - /cli-documentation/v10/npm-logout |
| 23 | - /cli/cli-commands/logout |
| 24 | - /cli/cli-commands/npm-logout |
| 25 | - /cli/commands/logout |
| 26 | - /cli/commands/npm-logout |
| 27 | - /cli/logout |
| 28 | - /cli/npm-logout |
| 29 | - /cli/v10/cli-commands/logout |
| 30 | - /cli/v10/cli-commands/npm-logout |
| 31 | - /cli/v10/commands/logout |
| 32 | - /cli/v10/logout |
| 33 | - /cli/v10/npm-logout |
| 34 | - /commands/logout |
| 35 | - /commands/npm-logout |
| 36 | --- |
| 37 | |
| 38 | ### Synopsis |
| 39 | |
| 40 | ```bash |
| 41 | npm logout |
| 42 | ``` |
| 43 | |
| 44 | Note: This command is unaware of workspaces. |
| 45 | |
| 46 | ### Description |
| 47 | |
| 48 | 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. |
| 49 | |
| 50 | 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 _only_ affect the current environment. |
| 51 | |
| 52 | If `--scope` is provided, this will find the credentials for the registry connected to that scope, if set. |
| 53 | |
| 54 | ### Configuration |
| 55 | |
| 56 | #### `registry` |
| 57 | |
| 58 | - Default: "https://registry.npmjs.org/" |
| 59 | - Type: URL |
| 60 | |
| 61 | The base URL of the npm registry. |
| 62 | |
| 63 | #### `scope` |
| 64 | |
| 65 | - Default: the scope of the current project, if any, or "" |
| 66 | - Type: String |
| 67 | |
| 68 | Associate an operation with a scope for a scoped registry. |
| 69 | |
| 70 | Useful when logging in to or out of a private registry: |
| 71 | |
| 72 | ``` |
| 73 | # log in, linking the scope to the custom registry |
| 74 | npm login --scope=@mycorp --registry=https://registry.mycorp.com |
| 75 | |
| 76 | # log out, removing the link and the auth token |
| 77 | npm logout --scope=@mycorp |
| 78 | ``` |
| 79 | |
| 80 | This will cause `@mycorp` to be mapped to the registry for future installation of packages specified according to the pattern `@mycorp/package`. |
| 81 | |
| 82 | This will also cause `npm init` to create a scoped package. |
| 83 | |
| 84 | ``` |
| 85 | # accept all defaults, and create a package named "@foo/whatever", |
| 86 | # instead of just named "whatever" |
| 87 | npm init --scope=@foo --yes |
| 88 | ``` |
| 89 | |
| 90 | ### See Also |
| 91 | |
| 92 | - [npm adduser](/cli/v10/commands/npm-adduser) |
| 93 | - [npm registry](/cli/v10/using-npm/registry) |
| 94 | - [npm config](/cli/v10/commands/npm-config) |
| 95 | - [npm whoami](/cli/v10/commands/npm-whoami) |