如果你还没有 npm 用户账户,你可以创建一个账户以便在公共注册表上共享和下载 Javascript 包。

If you do not already have an npm user account, you can create an account in order to share and download Javascript packages on the public registry.

在网站上创建账户

Creating an account on the website

  1. 去到 npm 注册页面

    Go to the npm signup page

  2. 在用户注册表单中,输入以下字段:

    In the user signup form, type in the fields:

    • 用户名:当你在 npmjs.com 上发布包或与其他 npm 用户交互时将显示的用户名。你的用户名必须小写,并且可以包含连字符和数字。

      Username: The username that will be displayed when you publish packages or interact with other npm users on npmjs.com. Your username must be lower case, and can contain hyphens and numerals.

    • 电子邮件地址:你的公共电子邮件地址将被添加到你的包的元数据中,并且任何下载你的包的人都可以看到。当你更新包以及不定期的产品更新和信息时,我们也会向此账户发送电子邮件。

      Email address: Your public email address will be added to the metadata of your packages and will be visible to anyone who downloads your packages. We will also send email to this account when you update packages, as well as occasional product updates and information.

    • 密码:你的密码必须符合 我们的密码指南

      Password: Your password must meet our password guidelines.

    Screenshot of the signup form
  3. 阅读 终端用户许可协议隐私政策,并表明你同意它们。

    Read the End User License Agreement and Privacy Policy, and indicate that you agree to them.

    Screenshot of the privacy policy
  4. 单击创建账户。

    Click Create An Account.

    Screenshot of the create account button

注意:注册 npm 账户后,你将收到一封账户验证电子邮件。你必须验证你的电子邮件地址才能将包发布到注册表。

Note: After signing up for an npm account, you will receive an account verification email. You must verify your email address in order to publish packages to the registry.

使用 npm login 测试你的新账户

Testing your new account with npm login

使用 npm login 命令测试登录到你的新账户。

Use the npm login command to test logging in to your new account.

注意:如果你在使用 npm login 命令登录时拼错了现有账户用户名,你将使用拼写错误的名称创建一个新账户。如需有关意外创建账户的帮助,请联系 联系 npm 支持

Note: If you misspell your existing account username when you log in with the npm login command, you will create a new account with the misspelled name. For help with accidentally-created accounts, contact npm Support.

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

    On the command line, type the following command:

    npm login
  2. 出现提示时,输入你的用户名、密码和电子邮件地址。

    When prompted, enter your username, password, and email address.

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

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

  4. 要测试你是否已成功登录,请键入:

    To test that you have successfully logged in, type:

    npm whoami

    应该显示你的 npm 用户名。

    Your npm username should be displayed.

npm 中文网 - 粤ICP备13048890号