Installing Node and NPM is pretty straightforward using the installer package available from the Node.js® web site.
- Download the Windows installer from the Nodes.js® web site.
- 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 and to run a simple test program:
- 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 a version number, so you’ll see something like this
- Test NPM. To see if NPM is installed, type
npm -vin Terminal. This should print NPM’s version number so you’ll see something like this
hello.js, and just add the code
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 and run the code in the
hello.jsfile. You should see the output
Node is installed!.
New versions of Node and NPM come out frequently. To install the updates, justdownload the installer from the Nodejs.org site and run it again. The new version of Node 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 Windows software:
- Open the Windows Control Panel
- Choose the “Programs and Features” option
- Click the “Uninstall a program” option
- Select Node.js, and click the Uninstall link.
With Node.js and NPM installed you’ll soon be able to take advantage of the huge world of NPM modules that can help with a wide variety of tasks both on the web server and on your desktop (or laptop) machine. The NPM site lists all of the official Node packages making it easy to make the choice. Have fun and check out my current courses at Treehouse. And after, you’ve installed Node, check out theNode.js Basics course on Treehouse by my colleague, Andrew Chalkley.