npm 添加用戶 adduser

2021-10-29 10:48 更新

添加注冊(cè)用戶賬戶。

概要

npm adduser [--registry=url] [--scope=@orgname] [--always-auth] [--auth-type=legacy]


aliases: login, add-user

詳情

在指定注冊(cè)表中創(chuàng)建或驗(yàn)證名為<username>的用戶,并將憑據(jù)保存在到 .npmrc 文件中。如果未指定注冊(cè)表,則使用默認(rèn)注冊(cè)表。(請(qǐng)參考配置

從提示中讀取用戶名、密碼和電子郵件。

想要重置密碼??梢栽L問這里。

想要更改你的電子郵件地址,可以訪問這里

你可以使用統(tǒng)一用戶賬戶多次使用此命令在新機(jī)器上授權(quán)。在新機(jī)器上進(jìn)行身份驗(yàn)證時(shí),用戶名、密碼和電子郵件地址都必須與你現(xiàn)有的記錄匹配。

npm login 是一個(gè) adduser 的別名,其行為方式完全相同。

配置

registry 注冊(cè)表

  • 默認(rèn)值:http://registry.npmjs.org/
  • 類型: Url

npm 包注冊(cè)表的基本 URL。

scope 范圍

  • 默認(rèn)值:當(dāng)前項(xiàng)目的范圍(如果有),或 ""
  • 類型:String

將操作與作用域注冊(cè)表的作用域相關(guān)聯(lián)。

登錄或注銷專用注冊(cè)表時(shí)非常有用:

## log in, linking the scope to the custom registry
npm login --scope=@mycorp --registry=https://registry.mycorp.com
## log out, removing the link and the auth token
npm logout --scope=@mycorp

這將導(dǎo)致@mycorp映射到注冊(cè)表,以便將來安裝根據(jù)@mycorp/package模式指定的包。

這還將導(dǎo)致npm init創(chuàng)建一個(gè)范圍包。

## accept all defaults, and create a package named "@foo/whatever",
## instead of just named "whatever"
npm init --scope=@foo --yes
以上內(nèi)容是否對(duì)您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)