Note: You must use NPM version 2 or higher to use scopes. To upgrade to the latest version of NPM, run it from the command line

npm install npm@latest -g  
Copy the code

When registering an NPM user account or creating an organization, you will be granted a scope that matches your user name or organization name. You can use this scope as a namespace for related packages. Scopes allow you to create packages with the same package name as other users or organizations without conflict. When listed as dependencies in package.json, the scoped package begins with its scope name, which is prime content between @ and the slash:

  • “NPM” scope:
@npm/package-name
Copy the code
  • Npmcorp scope:
@npmcorp/package-name
Copy the code

Creating and publishing scoped public Packages for Creating and publishing scoped public packages. For Creating and publishing private scoped packages, see “Creating and Publishing private Packages “.

Visibility of scope and package

  • Packages that have no scope are always public.
  • Private packages are always scoped.
  • The scoped package is private by default. You must pass command line flags when publishing to make them public.

For more information about Package scope and visibility, see Package Scope, Access Level, and Visibility