DEV Community

Mennatulllah
Mennatulllah

Posted on

1

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)

Top comments (0)

Qodo Takeover

Introducing Qodo Gen 1.0: Transform Your Workflow with Agentic AI

Rather than just generating snippets, our agents understand your entire project context, can make decisions, use tools, and carry out tasks autonomously.

Read full post