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".

Note: You cannot change the visibility of an unscoped package. Only scoped packages with a paid subscription may be private.

Making a public package private

Note: Making a package private requires a paid user account or organization. To sign up for a paid user or organization, go to https://www.npmjs.com/settings/account-name/billing, replacing account-name with the name of your npm user account or organization.

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. On the npm website, go to the package page.
  2. On the package page, click Settings.
  3. Under "Package Access", select "Is Package Private?"
  4. Click Update package settings.

Using the command line

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>

For more information, see the npm access documentation.

Making a private package public

Note: When you make a private package public, the package will be visible to and downloadable by all npm users.

Using the website

  1. On the npm website, go to the package page.
  2. On the package page, click Settings.
  3. Under "Package Access", deselect "Is Package Private?"
  4. Click Update package settings.

Using the command line

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>

For more information, see the npm access CLI documentation.

Edit this page on GitHub
1 contributormona
Last edited by mona on March 21, 2023
声明:npm 及相关 logo 的版权归 npmjs.com 所有。本站点仅用于 npm 中文文档,与 npmjs.com 没有任何关系。由于译者水平有限,且避免产生误解,条款和政策内容不进行翻译,关于这部分,请移步官网查看最新内容。