Configuring your npm client with your Org settings

As an Org member, you can configure your npm client to:

Before configuring your npm client, you must install npm.

Configuring your npm client to use your Org’s scope

If you will be publishing packages with your Org’s scope often, you can add your Org’s scope to your global .npmrc configuration file.

Setting your Org scope for all new packages

Note: Setting the Org 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.

  1. On the command line, type the following command:
     npm config set scope <org-name> --global
    
  2. Press Enter.

For packages you do not want to publish with your Org’s scope, you must manually edit the package’s package.json to remove the Org scope from the name field.

Setting your Org scope for a single package

  1. On the command line, navigate to the package directory. cd /path/to/package
  2. Type the following command, replacing with the name of your Org:
     npm config set scope <org-name>
    
  3. Press Enter.

Changing default package visibility to public

By default, publishing a scoped package with npm publish will publish the package as private. If you are a member of an Org on the free Org plan, or are on the paid Org plan but want to publish a scoped package as public, you must pass the --access public flag:

npm publish --access public.

Setting package visibility to public for a single package

You can set a single package to pass --access public to every npm publish command that you issue for that package.

  1. On the command line, navigate to the package directory. cd /path/to/package
  2. Type the following command:
     npm config set access public
    
  3. Press Enter.

Setting package visibility to public for all packages

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

  1. On the command line, type the following command:
     npm config set access public --global
    
  2. Press Enter.

< About Org scopes and packages | Creating and publishing an Org scoped package >