你可以从网站或命令行更改范围包的可见性。
🌐 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
🌐 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
🌐 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.