你可以从网站或命令行管理用户账户个人资料的设置。

You can manage settings for your user account profile from the web or command line.

从网站管理用户账户个人资料设置

Managing user account profile settings from the web

在网站上,你可以更改以下用户个人资料设置:

From the web, you can change the following user profile settings:

  • 头像

    Avatar

  • 密码

    Password

  • 全名

    Full name

  • GitHub 账户链接

    Link GitHub Account

  • Twitter 账户链接

    Link Twitter Account

  • 添加到包元数据的电子邮件地址

    Email address added to package metadata

  • 双重身份验证状态

    Two-factor authentication status

  1. 在 npm“登录”页面上,输入您的帐户详细信息并单击登录 Screenshot of npm login dialog
  2. 在页面的右上角,点击您的个人资料照片,然后点击帐户 Screenshot of account settings selection in user menu

链接你的 npm 和 GitHub 账户

Linking your npm and GitHub accounts

  1. 在账户设置页面上,你会找到一个链接你的 GitHub 账户的按钮。点击那个。

    On the account settings page, you will find a button to link your GitHub account. Click that.

    Screenshot of linking from Account Setting without any accounts linked
  2. 如果你当前未登录 GitHub,系统将提示你完成身份验证流程。

    If you are not currently logged in to GitHub you will be prompted to go through the authentication flow.

    GitHub login form
  3. 成功登录后,或者如果你已经有一个活跃的浏览器会话,你会被提示到 "授权 npm 账户链接",点击按钮。

    After successfully logging in, or if you already had an active browser sessions, you will be prompted to "authorize npm account link", click the button.

    Landing page to authorize the installation of the npm account linking app
  4. 你将被重定向到 npm,并且该链接将在你的设置中显示为成功。

    You will be redirected to npm and the link will show as successful in your settings.

    Screenshot of linking from Account Setting with successfully linked GitHub account

链接你的 npm 和 Twitter 账户

Linking your npm and Twitter accounts

  1. 在账户设置页面上,你会找到一个链接你的 Twitter 账户的按钮。点击那个。

    On the account settings page, you will find a button to link your Twitter account. Click that.

    Screenshot of linking from Account Setting without any accounts linked
  2. 如果你当前未登录 Twitter,系统将提示你完成身份验证流程。点击 "登录"

    If you are not currently logged in to Twitter you will be prompted to go through the authentication flow. Click "Log in"

    Twitter login form
  3. 成功登录后,或者如果你已经有一个活跃的浏览器会话,你会被提示到 "授权应用",点击按钮。

    After successfully logging in, or if you already had an active browser sessions, you will be prompted to "Authorize app", click the button.

    Landing page to authorize the installation of the npm account linking app
  4. 你将被重定向到 npm,并且该链接将在你的设置中显示为成功。

    You will be redirected to npm and the link will show as successful in your settings.

    Screenshot of linking from Account Setting with successfully linked Twitter account

从 npm 中删除你的 GitHub 账户

Removing your GitHub account from npm

  1. 在账户设置页面上,你会找到一个按钮来删除你的 GitHub 账户。点击那个。

    On the account settings page, you will find a button to remove your GitHub account. Click that.

    Screenshot of linking from Account Setting with a cursor hovering over remove button

    注意:单击删除只会从你的 npm 账户中删除该链接。你需要从你的 GitHub 应用授权设置 获得 revoke 权限才能从你的 GitHub 账户中永久删除集成

    Note: Clicking remove will only remove the link from your npm account. You need to revoke permissions from your GitHub app authorization settings to permanently remove the integration from your GitHub account

从 npm 中删除你的 Twitter 账户

Removing your Twitter account from npm

  1. 在账户设置页面上,你会找到一个按钮来删除你的 GitHub 账户。点击那个。

    On the account settings page, you will find a button to remove your GitHub account. Click that.

    Screenshot of linking from Account Setting with a cursor hovering over remove button

    注意:单击删除只会从你的 npm 账户中删除该链接。你需要从你的 Twitter 连接应用管理页面 获得 revoke 权限才能从你的 Twitter 账户中永久删除集成

    Note: Clicking remove will only remove the link from your npm account. You need to revoke permissions from your Twitter connect apps management page to permanently remove the integration from your Twitter account

从命令行管理用户账户个人资料设置

Managing user account profile settings from the command line

注意:你的 npm 客户端必须是 5.5.1 或更高版本才能从 CLI 更改你的账户设置。要更新到最新版本的 npm,请在命令行上运行 npm install npm@latest -g

Note: Your npm client must be version 5.5.1 or higher to change your account settings from the CLI. To update to the latest version of npm, on the command line, run npm install npm@latest -g

从命令行查看用户账户个人资料设置

Viewing user account profile settings from the command line

要从 CLI 查看你的用户个人资料设置,请在命令行上运行以下命令:

To view your user profile settings from the CLI, on the command line, run the following command:

npm profile get Screenshot of command-line interface profile settings table

从命令行更新用户账户个人资料设置

Updating user account profile settings from the command line

在 CLI 中,你可以更改用户账户的以下属性:

From the CLI, you can change the following properties for your user account:

  • email

  • two-factor auth

  • fullname

  • homepage

  • freenode

  • password

  1. 在命令行上,键入以下命令,将 property 替换为属性名称,将 value 替换为新值:

    On the command line, type the following command, replacing property with the name of the property, and value with the new value:

    npm profile set <prop> <value>
  2. 出现提示时,提供你当前的密码。

    When prompted, provide your current password.

  3. 如果你在账户上启用了双重身份验证,则在出现提示时输入一次性密码。

    If you have enabled two-factor authentication on your account, when prompted, enter a one-time password.

有关详细信息,请参阅 profile 命令行文档

For more details, see the profile command line documentation.

从命令行设置密码

Setting a password from the command line

  1. 在命令行上,键入以下命令:

    On the command line, type the following command:

npm profile set password
  1. 出现提示时,提供你当前的密码。

    When prompted, provide your current password.

  2. 出现提示时,键入新密码。

    When prompted, type a new password.

为了保护你的账户,当你从命令行重置密码时,它必须:

To protect your account, when you reset your password from the command line, it must:

  • 超过 10 个字符

    be longer than 10 characters

  • 不包含你的用户名的一部分

    not contain part of your username

  • 不在“Have I Been Pwned”违规数据库中

    not be in the "Have I Been Pwned" breach database

从命令行配置双重身份验证

Configuring two-factor authentication from the command line

在你的账户上启用双重身份验证有助于防止未经授权访问你的账户和包。

Enabling two-factor authentication on your account helps protect against unauthorized access to your account and packages.

要从命令行启用、配置和禁用双重身份验证,请参阅“配置双重身份验证”。

To enable, configure, and disable two-factor authentication from the command line, see "Configuring two-factor authentication".

npm 中文网 - 粤ICP备13048890号