What is Node.js®?
Node.js® is a JavaScript-based environment which you can use to create web-servers and networked applications.
What is 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.
NPM is installed when you install Node.js®
Here are the steps to install Node.js and NPM:
- Download the setup from Nodejs.org.
- Run the setup (the .msi file you downloaded in the previous step.)
- Follow the prompts in the setup (Accept the license agreement, click the NEXT button a bunch of times and accept the default installation settings).
- Now restart your computer. You won’t be able to run Node.js until you restart your computer.
You can check what version of each is installed by running simple commands:
- Testing Node. Open the Windows Command Prompt, Powershell or a similar command line tool, and type node -v
- Testing NPM. Open the Windows Command Prompt, Powershell or a similar command line tool, and type npm -v
- And to make sure that node.js is working properly. Create a test JavaScript file: name it hello.js, and just add the code
console.log('Node is installed!');
Now open your command line program, navigate to the folder where you save the file and type node hello.js.
You should see the output Node is installed!. If you see this output it means node.js is working properly. Enjoy 🙂