Node.js and Node Package Manager (npm)

Node.js

Node.js is required for using many JavaScript tools and for creating server-side JavaScript applications. In this document, we show you how to check if Node.js is installed and to install it if it is not.

Node Package Manager (npm) is the default package manager for Node.js. It is used for installing, upgrading, configuring, and removing modules used by Node.js applications.

First, Check if Node and npm are Already Installed

  1. Open a terminal in Visual Studio Code by selecting Terminal > New Terminal.
  2. At the terminal, run node -v:
    $ node -v
    v20.14.0
  3. If the version is 20 or higher of Node is installed and npm is also installed, you are all set with Node.js. If Node.js or npm is not installed or the version of Node.js is earlier than 20, you need to install them.

If Node.js is Not Installed Already or You Have an Old Version…

You need to install a new version of Node.js.

  1. Go to nodejs.org. Click the download button or link for the LTS (Long Term Support) version.
  2. When the file finishes downloading, locate it in your file system and double-click on it.
  3. Go through the entire installation process.
  4. When installation is complete, close the installer. Both Node and NPM will have been installed.
  5. Open Visual Studio Code.
  6. If the Terminal is open, kill it by clicking on the trash can: vs code kill terminal
  7. Go to the top of this document and repeat the steps for opening a new terminal to confirm that you now have a new version of Node.js.

Written by Nat Dunn. Follow Nat on Twitter.