npm 配置文件 profile
更改注册表配置文件上的设置
概要
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
描述
在注册表中更改您的配置文件信息。如果您使用的是非 npmjs 注册表,则此选项不可用。
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>:设置配置文件属性的值。你可以通过这种方式设置以下属性:email、fullname、homepage、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:始终需要一个 OTPauth-only,并且在发布模块、设置latestdist-tag 或通过npm access和更改访问时也需要一个npm owner。
npm profile disable-2fa:禁用两因素身份验证。
细节
所有npm profile子命令都接受--json并将--parseable根据这些来定制它们的输出。其中一些命令在非 npmjs.com 注册表上可能不可用。
配置
registry 注册表
- 默认值:
https://registry.npmjs.org/ - 类型:
Url
npm 注册表的基本 URL。
json
- 默认值:
false - 类型:
Boolean
是否输出JSON数据,而不是正常输出。
npm pkg set它允许在将设置值保存到您的package.json.并非所有 npm 命令都支持。
parseable 可解析
- 默认值:
false - 类型:
Boolean
从写入标准输出的命令输出可解析的结果。对于 npm search,这将是制表符分隔的表格格式。
otp
- 默认值:
null - 类型:
null或String
这是来自两因素身份验证器的一次性密码。使用npm access.
如果未设置,并且注册表响应失败并质询一次性密码,npm 将在命令行上提示输入密码。