目錄
npm-logout
登出登錄
選擇 CLI 版本
目錄
概要
npm logout
注意:此指令不知道工作區。
說明
當登入支援基於令牌驗證的登錄時,會指示伺服器結束此令牌的階段。這會在您使用令牌的所有地方(不只是目前的環境)失效令牌。
當登入使用使用者名稱和密碼驗證的舊版登錄時,這會清除使用者組態中的憑證。在此情況下,這只會影響目前的環境。
如果提供 --scope
,這會尋找與該範圍(如果已設定)連接的登錄憑證。
組態
登錄
- 預設值:"https://registry.npmjs.org/"
- 類型:URL
npm 登錄的基本 URL。
範圍
- 預設值:目前專案的範圍(如果有)或 ""
- 類型:字串
將作業與範圍登錄的範圍關聯。
在登入或登出私人登錄時很有用
# 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
模式指定的套件的未來安裝,對應到登錄。
這也會導致 npm init
建立一個範圍套件。
# accept all defaults, and create a package named "@foo/whatever",# instead of just named "whatever"npm init --scope=@foo --yes