作为包所有者或维护者,你可以使用 npm 网站或命令行将不再希望维护的包的所有权转让给另一个受信任的 npm 用户。

¥As a package owner or maintainer, you can transfer ownership of a package you no longer wish to maintain to another trusted npm user using either the npm website or the command line.

有关 npm 支持如何处理用户之间的包名争议的更多信息,你可以参考 npm 的 包名争议政策

¥For more information on how npm support handles package name disputes between users, you can refer to npm's package name dispute policy.

注意:你不能将范围包转移到另一个用户账户或组织,因为包的范围是用户账户或组织名称。你将需要在新范围内创建一个新包。

¥Note: You cannot transfer a scoped package to another user account or organization, because a package's scope is the user account or organization name. You will need to create a new package in the new scope.

在网站上将包从用户账户转移到另一个用户账户

¥Transferring a package from a user account to another user account on the website

要将你拥有或维护的包转让给其他用户,请执行以下步骤:

¥To transfer a package you own or maintain to another user, follow these steps:

  1. 导航到你要传输的包的包页面,将 <your-package-name> 替换为你的包名称:https://www.npmjs.com/package/<your-package-name>

    ¥Navigate to the package page for the package you want to transfer, replacing <your-package-name> with the name of your package: https://www.npmjs.com/package/<your-package-name>.

  2. 在 package Admin 选项卡的 "维护者" 下,输入新维护者的 npm 用户名。

    ¥On the package Admin tab, under "Maintainers", enter the npm username of the new maintainer.

    Screenshot showing text field to invite maintainers
  3. 点击 "邀请。"

    ¥Click "Invite."

  4. 要删除自己的维护者身份,请在维护者列表下,单击你的用户名旁边的 "x"。

    ¥To remove yourself as a maintainer, under the maintainers list, click the "x" next to your username.

    Screenshot showing maintainer list

在命令行上将包从用户账户转移到另一个用户账户

¥Transferring a package from a user account to another user account on the command line

要使用 CLI 将包转移给另一个 npm 用户,请运行 npm owner add 命令,将 <their-username> 替换为其他用户的 npm 用户名。向其他用户发送电子邮件邀请。用户接受邀请后,运行 npm owner rm 命令,将 <your-username> 替换为你的 npm 用户名:

¥To transfer a package to another npm user using the CLI, run the npm owner add command replacing <their-username> with the other user's npm username. An email invitation is sent to the other user. After the user has accepted the invitation, run the npm owner rm command replacing <your-username> with your npm username:

npm owner add <their-username> <package-name>
# new maintainer accepts invitation
npm owner rm <your-username> <package-name>

如果你为写入启用了双重身份验证,请向命令 --otp=123456 添加一次性密码(其中 123456 是你的身份验证器应用的代码)。

¥If you have two-factor authentication enabled for writes, add a one-time password to the command, --otp=123456 (where 123456 is the code from your authenticator application).

npm owner add <their-username> <package-name> --otp=123456
# new maintainer accepts invitation
npm owner rm <your-username> <package-name> --otp=123456
npm 中文网 - 粤ICP备13048890号