What’s Node.js® and NPM?
NPM is a “package manager” that makes installing Node “packages” fast and easy. A package is just a code library that extends Node by adding useful features. For example, the “request” package simplifies the process of making HTTP requests so you can easily get web resources from other sites.
NPM is installed when you install Node.js®
- You should have some familiarity with an application that lets you issue command line instructions. For example, the Windows Command Prompt, PowerShell, Cygwin, or the Git shell (which you get when you install Github for Windows).
Installing Node.js® and NPM is pretty straightforward using the installer package available from the Node.js web site.
- Download the Windows installer from Nodejs.org.
- Run the installer (the .msi file you downloaded in the previous step.)
- Follow the prompts in the installer (Accept the license agreement, click the NEXT button a bunch of times and accept the default installation settings).
- Restart your computer. You won’t be able to run Node.js until you restart your computer.
Make sure you have Node and NPM installed by running simple commands to see what version of each is installed:
- Test Node. To see if Node is installed, open the Windows Command Prompt, Powershell or a similar command line tool, and type
node -v. This should print the version number so you’ll see something like this
- Test NPM. To see if NPM is installed, type
npm -vin Terminal. This should print the version number so you’ll see something like this
console.log('Node is installed!');. To run the code simply open your command line program, navigate to the folder where you save the file and type
node hello.js. This will start Node.js and run the code in the
hello.jsfile. You should see the output
Node is installed!.
How to Update Node and NPM
New versions of Node and NPM come out frequently. To install the updates, just download the installer from the Nodejs.org site and run it again. The new version of Node.js and NPM will replace the older versions.
How to Uninstall Node and NPM
You uninstall Node.js and NPM the same as you would most all Windows software:
- Open the Windows Control Panel
- Choose the Programs and Features option
- Click the “Uninstall a program”
- Select Node.js, and click the Uninstall link.