Quick reference to Create and publish your first NPM package

mennatulllah

Mennatulllah

Posted on April 19, 2020

Quick reference to Create and publish your first NPM package

1- first step if you don't have an npm registry account, you can sign up from : https://www.npmjs.com/signup or use command: npm adduser

(note: it's better to signup using the site url in order to solve errors of available usernames, password complexity ..etc)

2- verify the account

3- npm login

4- fill in the conditionals

5- mkdir "package-name"

6- cd "package-name"

7- npm init
(note: if you want to make it scoped to specific organization or user account (private packages) you should use this init command with the scope flag (eg: npm init --scope=@user-name) and this feature for paid accounts only)

8- now you can test the package locally by running command : npm i "package-name"

9- npm publish
(note: you may have to change the package name if you get publishing error because of name duplication)

💖 💪 🙅 🚩
mennatulllah
Mennatulllah

Posted on April 19, 2020

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related