npm-profile

變更您的註冊檔個人資料設定

選擇 CLI 版本

概要

npm profile enable-2fa [auth-only|auth-and-writes]
npm profile disable-2fa
npm profile get [<key>]
npm profile set <key> <value>

注意:此指令不了解工作區。

說明

變更您在註冊檔中的個人資料資訊。請注意,此指令取決於註冊檔實作,因此第三方註冊檔可能不支援此介面。

  • npm profile get [<property>]:顯示您的個人資料的所有屬性,或一個或多個特定屬性。它看起來像
+-----------------+---------------------------+
| name | example |
+-----------------+---------------------------+
| email | me@example.com (verified) |
+-----------------+---------------------------+
| two factor auth | auth-and-writes |
+-----------------+---------------------------+
| fullname | Example User |
+-----------------+---------------------------+
| homepage | |
+-----------------+---------------------------+
| freenode | |
+-----------------+---------------------------+
| twitter | |
+-----------------+---------------------------+
| github | |
+-----------------+---------------------------+
| created | 2015-02-26T01:38:35.892Z |
+-----------------+---------------------------+
| updated | 2017-10-02T21:29:45.922Z |
+-----------------+---------------------------+
  • npm profile set <property> <value>:設定個人資料屬性的值。您可以透過這種方式設定下列屬性:電子郵件、全名、首頁、freenode、twitter、github

  • npm profile set password:變更您的密碼。這是一個互動式命令,系統會提示您輸入目前的密碼和新的密碼。如果您已啟用雙重驗證,系統也會提示您輸入 OTP。

  • npm profile enable-2fa [auth-and-writes|auth-only]:啟用雙重驗證。預設為 auth-and-writes 模式。模式如下:

    • auth-only:登入或變更帳戶驗證時需要 OTP。網站和命令列都需要 OTP。
    • auth-and-writes:在 auth-only 所需的所有時機需要 OTP,並在發布模組、設定 latest dist-tag,或透過 npm accessnpm owner 變更存取權時需要 OTP。
  • npm profile disable-2fa:停用雙重驗證。

詳細資料

某些命令可能無法在非 npmjs.com 註冊中使用。

組態

registry

npm 註冊的基礎網址。

json

  • 預設值:false
  • 類型:布林值

是否輸出 JSON 資料,而不是一般輸出。

  • npm pkg set 中,它會在將設定值儲存到 package.json 之前,使用 JSON.parse() 來解析這些值。

並非所有 npm 命令都支援。

parseable

  • 預設值:false
  • 類型:布林值

從寫入標準輸出的命令中輸出可解析的結果。對於 npm search,這將是 tab 分隔的表格格式。

otp

  • 預設值:null
  • 類型:null 或字串

這是來自雙重驗證器的一次性密碼。在使用 npm access 發布或變更套件權限時需要。

如果未設定,且註冊回應失敗,並要求提供一次性密碼,npm 會在命令列提示您輸入密碼。

另請參閱