npm 配置文件 profile

2021-10-29 10:50 更新

更改注冊(cè)表配置文件上的設(shè)置

概要

npm profile get [--json|--parseable] [<property>]
npm profile set [--json|--parseable] <property> <value>
npm profile set password
npm profile enable-2fa [auth-and-writes|auth-only]
npm profile disable-2fa

描述

在注冊(cè)表中更改您的配置文件信息。如果您使用的是非 npmjs 注冊(cè)表,則此選項(xiàng)不可用。

npm profile get [<property>]:顯示您的配置文件的所有屬性,或一個(gè)或多個(gè)特定屬性??雌饋硐瘢?/p>

+-----------------+---------------------------+
| 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>:設(shè)置配置文件屬性的值。你可以通過這種方式設(shè)置以下屬性:email、fullname、homepage、freenodetwitter、github

  • npm profile set password: 更改你的密碼。這是交互式的,系統(tǒng)會(huì)提示你輸入當(dāng)前密碼和新密碼。如果你啟用了雙因素身份驗(yàn)證,系統(tǒng)還會(huì)提示你輸入 OTP。

  • npm profile enable-2fa [auth-and-writes|auth-only]:?jiǎn)⒂脙梢蛩厣矸蒡?yàn)證。默認(rèn)為auth-and-writes模式。模式是:

    • auth-only:登錄或更改帳戶身份驗(yàn)證時(shí)需要 OTP。網(wǎng)站和命令行都需要 OTP。
    • auth-and-writes:始終需要一個(gè) OTP?auth-only,并且在發(fā)布模塊、設(shè)置latestdist-tag 或通過npm access和更改訪問時(shí)也需要一個(gè)npm owner。

  • npm profile disable-2fa:禁用兩因素身份驗(yàn)證。

細(xì)節(jié)

所有npm profile子命令都接受--json并將--parseable根據(jù)這些來定制它們的輸出。其中一些命令在非 npmjs.com 注冊(cè)表上可能不可用。

配置

registry 注冊(cè)表

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

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

json

  • 默認(rèn)值:false
  • 類型:Boolean

是否輸出JSON數(shù)據(jù),而不是正常輸出。

npm pkg set它允許在將設(shè)置值保存到您的package.json.并非所有 npm 命令都支持。

parseable 可解析

  • 默認(rèn)值:false
  • 類型:Boolean

從寫入標(biāo)準(zhǔn)輸出的命令輸出可解析的結(jié)果。對(duì)于?npm search,這將是制表符分隔的表格格式。

otp

  • 默認(rèn)值:null
  • 類型:nullString

這是來自兩因素身份驗(yàn)證器的一次性密碼。使用npm access.

如果未設(shè)置,并且注冊(cè)表響應(yīng)失敗并質(zhì)詢一次性密碼,npm 將在命令行上提示輸入密碼。

以上內(nèi)容是否對(duì)您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

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

編程獅公眾號(hào)