目录
选择命令行版本:
目录
概要
¥Synopsis
npm logout
注意:此命令对工作区无感知。
¥Note: This command is unaware of workspaces.
描述
¥Description
登录到支持基于令牌的身份验证的注册表时,告诉服务器结束此令牌的会话。这将使令牌在你使用它的任何地方都无效,而不仅仅是当前环境。
¥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.
当登录到使用用户名和密码身份验证的旧注册表时,这将清除用户配置中的凭据。在这种情况下,它只会影响当前环境。
¥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.
如果提供了 --scope
,这将找到连接到该范围的注册表的凭据(如果已设置)。
¥If --scope
is provided, this will find the credentials for the registry connected to that scope, if set.
配置
¥Configuration
registry
-
默认值:"https://registry.npmjs.org/"
¥Default: "https://registry.npmjs.org/"
-
类型:URL
¥Type: URL
npm 注册表的基本 URL。
¥The base URL of the npm registry.
scope
-
默认值:当前项目的范围(如果有)或 ""
¥Default: the scope of the current project, if any, or ""
-
类型:字符串
¥Type: String
将操作与范围注册表的作用域相关联。
¥Associate an operation with a scope for a scoped registry.
在登录或退出私有注册表时很有用:
¥Useful when logging in to or out of a private registry:
# log in, linking the scope to the custom registrynpm login --scope=@mycorp --registry=https://registry.mycorp.com# log out, removing the link and the auth tokennpm logout --scope=@mycorp
这将导致 @mycorp
映射到注册表,以便将来安装根据模式 @mycorp/package
指定的包。
¥This will cause @mycorp
to be mapped to the registry for future installation of packages specified according to the pattern @mycorp/package
.
这也将导致 npm init
创建一个范围包。
¥This will also cause npm init
to create a scoped package.
# accept all defaults, and create a package named "@foo/whatever",# instead of just named "whatever"npm init --scope=@foo --yes
也可以看看
¥See Also