Skip to content

2) How to install Node.js and NPM (Node Package Manager)

Coding With The Force edited this page Feb 12, 2023 · 3 revisions

How to install Node.js and NPM (Node Package Manager)

Why do I need to install Node.js and NPM?

Jest is a Node module, or in more plain terms, it was built using Node.js (which is a popular development language), so to be able to run your Jest tests you will need to have Node.js installed on your local machine.

To install Jest you will need to have what's referred to as a package manager installed on your machine as well. NPM is short for Node Package Manager and it just comes with Node.js when you install it! So instead of going out and looking for another package manager like Chocolatey or something, we might as well just use NPM since we have to install Node.js anyway to get things working!


How to Install Node.js and NPM

Installing Node.js and NPM is quick and painless. All you need to do is go here to download the installer and then run it! It would suggest using the LTS (Long Term Support) section of the downloads area as it is the most stable current version of Node. When you download Node.js, as stated previously, it also installs NPM! It's a one stop shop!

When you're done installing Node and NPM you can check to ensure they are installed by opening up a Windows Powershell or Windows Console (or the equivalent on your machine) and running the following commands:

  1. Run the following command to ensure Node.js is installed: node -v
  2. Run the following command to ensure NPM is installed: npm -v

The above commands when run should just display a version number to you in the powershell or console. For example 6.14.4 or something along those lines. If a version number displays, you know that everything installed as anticipated and you're good to go!


How to Upgrade Node.js and NPM in the future

There are multiple options available to upgrade Node.js and NPM, but the simplest way to upgrade node when new releases come out is to simply go back to the download page linked above and choose the latest version and install it. There are options like node.js version manager that you can look into here if you are interested in managing upgrades from your shell/console however.