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>]:显示你的配置文件的所有属性,或一个或多个特定属性。看起来像:

    ¥npm profile get [<property>]: Display all of the properties of your profile, or one or more specific properties. It looks like:

+-----------------+---------------------------+
| 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 <property> <value>: Set the value of a profile property. You can set the following properties this way: email, fullname, homepage, freenode, twitter, github

  • npm profile set password:更改你的密码。这是交互式的,系统会提示你输入当前密码和新密码。如果你启用了双重身份验证,系统还会提示你输入 OTP。

    ¥npm profile set password: Change your password. This is interactive, you'll be prompted for your current password and a new password. You'll also be prompted for an OTP if you have two-factor authentication enabled.

  • npm profile enable-2fa [auth-and-writes|auth-only]:启用双重身份验证。默认为 auth-and-writes 模式。模式是:

    ¥npm profile enable-2fa [auth-and-writes|auth-only]: Enables two-factor authentication. Defaults to auth-and-writes mode. Modes are:

    • auth-only:登录或更改账户身份验证时需要 OTP。网站和命令行都需要 OTP。

      ¥auth-only: Require an OTP when logging in or making changes to your account's authentication. The OTP will be required on both the website and the command line.

    • auth-and-writesauth-only 始终需要 OTP,并且在发布模块、设置 latest dist-tag 或通过 npm accessnpm owner 更改访问权限时也需要 OTP。

      ¥auth-and-writes: Requires an OTP at all the times auth-only does, and also requires one when publishing a module, setting the latest dist-tag, or changing access via npm access and npm owner.

  • npm profile disable-2fa:禁用双重身份验证。

    ¥npm profile disable-2fa: Disables two-factor authentication.

详情

¥Details

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

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

配置

¥Configuration

registry

npm 注册表的基本 URL。

¥The base URL of the npm registry.

json

  • 默认值:false

    ¥Default: false

  • 类型:布尔值

    ¥Type: Boolean

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

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

  • npm pkg set 中,它可以使用 JSON.parse() 解析集合值,然后再将它们保存到你的 package.json

    ¥In npm pkg set it enables parsing set values with JSON.parse() before saving them to your package.json.

并非所有 npm 命令都支持。

¥Not supported by all npm commands.

parseable

  • 默认值:false

    ¥Default: false

  • 类型:布尔值

    ¥Type: Boolean

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

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

otp

  • 默认值:null

    ¥Default: null

  • 类型:空值或字符串

    ¥Type: null or String

这是来自双重身份验证器的一次性密码。使用 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

npm 中文网 - 粤ICP备13048890号