Installing Node.js

We can use nvm (node version manager) to install Node.js on a Windows computer.

Download the nvm-setup.exe file from this link.

Run the nvm-setup.exe file to install nvm. You should accept the default folder settings that are presented during the installation.

nvm runs via the windows "cmd" shell.

Open the "cmd" shell from the start menu, as shown below.

Node.js is installed using nvm within the cmd shell.

We shall install Node.js version 4.5.0

Inside cmd type the line below. This will install Node.js

nvm install node 4.5.0

We can use nvm to install multiple version of Node.js. This can be useful over time, as we should tie each application that is released to the version of Node.js that it was developed with. This will ensure that we do not break legacy code as a result of future releases.

Install a second version of Node.js using the command below

nvm install 8.11.0

There are now two versions of Node.js on your computer. We can list all of the installed versions of Node.js using the command below.

nvm list

Running the above command will result in the screen below.

Type the command below to select the version of Node.js that you wish to use (You need administrator rights to run this).

nvm use 4.5.0

You can test that Node.js has been installed by running the command below

node --version

 

When nvm installs Node.js, it also install npm (node package manager). Type the command below to confirm that some version of npm was installed.

npm --version

NOTE: nvm only needs to be installed once. It can then be used to set up any number of Node.js projects.

 

 
<div align="center"><a href="../../versionC/index.html" title="DKIT Lecture notes homepage for Derek O&#39; Reilly, Dundalk Institute of Technology (DKIT), Dundalk, County Louth, Ireland. Copyright Derek O&#39; Reilly, DKIT." target="_parent" style='font-size:0;color:white;background-color:white'>&nbsp;</a></div>