Create an account from npmjs.com.
Install npm from a terminal console.
Login to the terminal with your new username.
Note: Many of the steps that you can take from the browser can also be taken directly from the Command Line Interface. Skip here to learn more.
Go to http://www.npmjs.com and click sign up.
Complete the sign up page.
Note: You must verify your email address before you can publish packages to the registry.
The welcome message has links to helpful resources; you might want to flag it for later reference.
Note: If you can't find the welcome message, please click to resend:
3 . Click the link in your email. Success! You will be sent to your new landing page.
Notice the URL:
This is a quick way to get to your page in the future.
You now have a login account. Here are a few things you can do before (or after) you install npm:
Or you can install npm in the terminal console, as explained below, then come back to these steps.
The following screen shot shows where the menu is if you want to explore the website, set up your profile, and get started right away:
Skip this section if you've worked with terminals or editors in the past.
Find the terminal emulator for your computer:
Find and pick a text editor that you like.
Consider signing up for a git account account if you haven't already.
There are additional resources for beginners and for everyone at the end of this chapter in the "Learn More" section.
npm is written in Node.js, so you need to install Node.js in order to use npm. You can install npm via the Node.js website, or by installing a Node Version Manager or NVM. This chapter explains both options.
If you just want to get started exploring npm, using the Node.js installation method is fastest. If you are an advanced developer ready to jump in and work with versions, use the node version manager. If you aren't sure, please read this chapter before you decide. You can always change how you run npm in the future.
If you're using OS X or Windows, use one of the installers from the Node.js download page. Be sure to install the version labeled LTS. Other versions have not yet been tested with npm.
If you're using Linux, choose one of these options:
Click here to learn about installing node.js for a variety of operating systems.
After installing, run
node -v. The version should be v8.9.1 or higher.
When you install node.js, npm is automatically installed. However, npm gets updated more frequently than Node.js, so be sure that you have the latest version.
To test, run
To be sure that this matches the latest version, scroll to the bottom of this page. If the version you see does not match the latest version, run:
npm install [email protected] -g.
This will install the latest official, tested version of npm.
Since npm and node.js products are managed by different entities, updates and maintenance can become complex. Also, the Node.js installation process installs npm in a directory that only has local permissions. This can cause permissions errors when you attempt to run packages globally.
To solve both these issues, many developers opt to use a node version manager, or nvm, to install npm. The version manager will avoid permissions errors, and will solve the complexities of updating Node.js and npm.
In addition, developers can use an nvm to test their applications on multiple versions of npm. The nvm enables you to easily switch npm as well as node versions. This makes it easier to ensure that your applications work for most users, even if they are using other versions of npm. If you decide to install a version manager, use the instructions for the version manager you select to learn how to switch versions, and to learn how to keep up-to-date with the latest version of npm.
Click here to learn how to install nvm for MacOs.
To install and manage npm and Node.js on Windows, we suggest nvm-windows.
Click here to learn how to install nvm for Linux.
To test your new account, type:
You will be prompted for your username, password, and email. Be sure to spell your username exactly the same way as you entered it on the website, or you will create a new account.
If you have already set up two-factor authentication, you will be asked for a one-time password when you login. Please see the chapter about two-factor authentication if you need more information.
To test that you have successfully logged in, type
For more advanced users
If you want to try the next, unreleased version of npm to test that packages you have created will work with the planned next release of npm, use this command:
npm install [email protected] -g
This may simply reinstall the current version, depending on the development cycle. Also, this early version is not final. So features may or may not match what is ultimately released.
To learn more about how to use node version manager, nvm, click here.
For tutorials, a chance to meet others, and step-by-steps, explore node school and its helpful site
See npm's Laurie Voss on "Stuff Everybody Knows Except You" if you are feeling overwhelmed in your dev learning. It will make you realize you are not alone!
How to use Apple's terminal Terminal.
How to use Microsoft Windows PowerShell.
How to find a Linux terminal emulators.
Note: While relevant CLI commands are covered throughout this user documentation, the CLI includes command line help, its own documentation section, and instant help (man pages).
Found a typo? Let us know!