Creating and publishing an organization scoped package
Table of contents
As an organization member, you can create and publish public and private packages within the organization's scope.
Creating an organization scoped package
-
On the command line, make a directory with the name of the package you would like to create.
mkdir /path/to/package/directory
-
Navigate to the newly-created package directory.
-
To create an organization scoped package, on the command line, run:
npm init --scope=<your_org_name>
-
To verify the package is using your organization scope, in a text editor, open the package's
package.json
file and check that the name is@your_org_name/<pkg_name>
, replacingyour_org_name
with the name of your organization.
Publishing a private organization scoped package
By default, npm publish
will publish a scoped package as private.
By default, any scoped package is published as private. However, if you have an organization that does not have the Private Packages feature, npm publish
will fail unless you pass the access
flag.
-
On the command line, navigate to the package directory.
-
Run
npm publish
.
Private packages will say private
below the package name on the npm website.
Publishing a public organization scoped package
To publish an organization scoped package as public, use npm publish --access public
.
-
On the command line, navigate to the package directory.
-
Run
npm publish --access public
.
Public packages will say public
below the package name on the npm website.