目錄
npm-adduser
新增登錄使用者帳戶
選擇 CLI 版本
目錄
概要
npm adduseralias: add-user
注意:此指令不認識工作區。
說明
在指定的登錄中建立新使用者,並將憑證儲存到 .npmrc
檔案中。如果未指定登錄,將使用預設登錄(請參閱 registry
)。
當您的 auth-type
使用 legacy
時,使用者名稱、密碼和電子郵件會從提示中讀取。
組態
登錄
- 預設值:"https://registry.npmjs.org/"
- 類型:網址
npm 登錄的基本網址。
範圍
- 預設值:目前專案的範圍(如果有的話),或 ""
- 類型:字串
將作業與範圍登錄的範圍關聯。
在登入或登出私人登錄時很有用
# 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
驗證類型
- 預設值:「web」
- 類型:「legacy」或「web」
與 login
一起使用的驗證策略。請注意,如果給定 otp
設定,這個值將永遠設為 legacy
。