npm-profile

更改注册表配置文件的设置

选择命令行版本:

概要

🌐 Synopsis

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

注意:此命令不支持工作区。

🌐 Note: This command is unaware of workspaces.

描述

🌐 Description

在注册表上更改你的个人资料信息。请注意,此命令依赖于注册表的实现,因此第三方注册表可能不支持此接口。

🌐 Change your profile information on the registry. Note that this command depends on the registry implementation, so third-party registries may not support this interface.

  • 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)。无论是在网站还是命令行上,都需要输入一次性密码。
    • auth-and-writes:在 auth-only 需要 OTP 的所有时候都需要 OTP,并且在发布模块、设置 latest 分发标签或通过 npm accessnpm owner 更改访问权限时也需要 OTP。
  • npm profile disable-2fa:禁用双重身份验证。

详情

🌐 Details

其中一些命令在非 npmjs.com 注册表上可能不可用。

🌐 Some of these commands may not be available on non npmjs.com registries.

配置

🌐 Configuration

registry

  • 默认: "https://registry.npmjs.org/"
  • 类型:网址

npm 注册表的基本 URL。

🌐 The base URL of the npm registry.

json

  • 默认:否
  • 类型:布尔

是否输出 JSON 数据,而不是正常输出。

🌐 Whether or not to output JSON data, rather than the normal output.

  • npm pkg set 中,它可以在将值保存到你的 package.json 之前使用 JSON.parse() 解析设置的值。

并非所有 npm 命令都支持。

🌐 Not supported by all npm commands.

parseable

  • 默认:否
  • 类型:布尔

从写入标准输出的命令中输出可解析的结果。对于 npm search,这将是制表符分隔的表格格式。

🌐 Output parseable results from commands that write to standard output. For npm search, this will be tab-separated table format.

otp

  • 默认值:空
  • 类型:空或字符串

这是来自双因素认证器的一次性密码。在使用 npm access 发布或更改软件包权限时需要此密码。

🌐 This is a one-time password from a two-factor authenticator. It's needed when publishing or changing package permissions with npm access.

如果未设置,并且注册表响应失败并询问一次性密码,npm 将在命令行上提示输入一次密码。

🌐 If not set, and a registry response fails with a challenge for a one-time password, npm will prompt on the command line for one.

也可以看看

🌐 See Also