目录

你可以从网站或命令行更改范围包的可见性。

🌐 You can change the visibility of a scoped package from the website or command line.

你必须是拥有包的用户账户或组织的所有者才能更改包的可见性。

🌐 You must be the owner of the user account or organization that owns the package in order to change package visibility.

有关包可见性的更多信息,请参阅“包作用域、访问级别和可见性”。

🌐 For more information about package visibility, see "Package scope, access level, and visibility".

注意: 你无法更改未限定作用域包的可见性。只有具有付费订阅的限定作用域包可以是私有的。

将公共包设为私有

🌐 Making a public package private

注意: 将包设置为私有需要付费用户账户或组织。要注册付费用户或组织,请访问 https://www.npmjs.com/settings/account-name/billing,并将 account-name 替换为你的 npm 用户账户或组织名称。

如果你想限制你拥有的公共包的访问和可见性,你可以将该包设为私有。将包设为私有后,其访问权限将立即更新,并且在更改后的几分钟内会从网站上移除。

🌐 If you want to restrict access and visibility for a public package you own, you can make the package private. When you make a package private, its access will be updated immediately and it will be removed from the website within a few minutes of the change.

使用网站

🌐 Using the website

  1. npm 网站 上,进入软件包页面。
  2. 在封装页面,点击 设置
  3. 在“包访问权限”下,选择“包是否为私有?”
  4. 点击 更新软件包设置

使用命令行

🌐 Using the command line

要在命令行中将公共包设为私有,请运行以下命令,将 <package-name> 替换为你的包名:

🌐 To make a public package private on the command line, run the following command, replacing <package-name> with the name of your package:

npm access restricted <package-name>

欲了解更多信息,请参阅 npm access 文档。

🌐 For more information, see the npm access documentation.

将私有包设为公共

🌐 Making a private package public

注意: 当你将私有包改为公开时,该包将对所有 npm 用户可见并可下载。

使用网站

🌐 Using the website

  1. 在 npm 网站上,跳转到包页面。
  2. 在封装页面,点击 设置
  3. 在“包访问权限”下,取消选择“包私有?”
  4. 点击 更新软件包设置

使用命令行

🌐 Using the command line

要在命令行中将私有包设为公开包,请运行以下命令,并将 <package-name> 替换为你的包名:

🌐 To make a private package public on the command line, run the following command, replacing <package-name> with the name of your package:

npm access public <package-name>

有关更多信息,请参阅 npm access CLI 文档

🌐 For more information, see the npm access CLI documentation.

目录