DEV Community

Rakesh Purohit
Rakesh Purohit

Posted on

How to publish my own NPM package ?

What is NPM?

As javascript developers, all of us use npm CLI and NPM in our everyday non-public or expert life. NPM is a large bundle dealing with a provider that offers an extensive variety of javascript applications that simplifies our venture and improvement process.

NPM stands for Node Package Manager. Node is a javascript runtime surroundings jogging at the V8 engine.

We all have used sizeable numbers of npm applications for projects, packages or perhaps for utilities. There are large open-supply individuals withinside the globe supplying loose applications on NPM.

Using any NPM bundle is remarkably simple. All we want is

npm i ~bundle-name~

NPM additionally manages the variations of all posted records of the bundle hosted at the platform.

Two sorts of applications may be hosted at the NPM Registry:

  1. Public
  2. Private

Public Packages are loose to submit, regulate and use. Anyone with an account on npmjs.com can submit an npm bundle. Similarly, every person with the machine set up Node can use the NPM applications.

Private Packages applications may be posted, changed and utilized by paid customers of NPM only. It is constrained to precise members.

How to publish your first NPM Package?

  1. Make sure Node is installed on your system.
  2. Make sure you have an account on NPM
  3. Login through CLI with npm login

It will ask for username, password and email for verification.
4.

mkdir my-test-package

5.

cd my-test-package

6.

npm init

Sample 1

Sample 2

  1. Hit

    npm publish

  2. Great! You have published your first npm package to the NPM registry.

Thank you for Reading !!

Top comments (0)