As an organization member, you can configure your npm client to:
Before configuring your npm client, you must install npm.
If you will be publishing packages with your organization's scope often, you can add your organization's scope to your global .npmrc
configuration file.
Note: Setting the organization scope using the steps below will only set the scope for new packages; for existing packages, you will need to update the name
field in package.json
.
On the command line, run the following command, replacing <org-name> with the name of your organization:
npm config set scope <org-name> --global
For packages you do not want to publish with your organization's scope, you must manually edit the package's package.json
to remove the organization scope from the name
field.
On the command line, navigate to the package directory.
cd /path/to/package
Run the following command, replacing <org-name> with the name of your organization:
npm config set scope <org-name>
By default, publishing a scoped package with npm publish
will publish the package as private. If you are a member of an organization on the free organization plan, or are on the paid organization plan but want to publish a scoped package as public, you must pass the --access public
flag:
npm publish --access public
You can set a single package to pass --access public
to every npm publish
command that you issue for that package.
On the command line, navigate to the package directory.
cd /path/to/package
Run the following command:
npm config set access public
You can set all packages to pass --access public
to every npm publish
command that you issue for that package.
Warning: Setting packages access to public
in your global .npmrc
will affect all packages you create, including packages in your personal account scope, as well as packages scoped to your organization.
On the command line, run the following command:
npm config set access public --global