How to publish a package to npm

Photo by Claudio Schwarz on Unsplash

How to publish a package to npm

Mohsen Kamrani's photo
Mohsen Kamrani
·Apr 30, 2022·

1 min read

Subscribe to my newsletter and never miss my upcoming articles

If you've built a package you want to publish as a public package to npm you can follow these steps:

  1. Sign up
  2. Create an organisation
  3. Choose the following option Screen Shot 2022-04-30 at 11.21.33 am.png
  4. On the command line, navigate to the root directory of your package
cd /path/to/package
  1. Authorize the machine to publish a package
npm login
  1. Publish the package

Assuming you've built the package correctly, you can publish it like this:

npm publish --access public

If you're interested to see a package publish exactly this way, take a look at this repository:

Share this