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

vs code new terminal
  1. Open a terminal in Visual Studio Code by selecting Terminal from the View menu:
  2. At the terminal, run node -v:
    $ node -v
    v16.16.0
    At the terminal, run node -v:
    $ npm -v
    8.15.0
  3. If the version is 16 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 16, 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. You'll see download links for your operating system: nodejs download
  2. Select the LTS version. The Current version has the latest features, but may be more prone to changes and bugs than the LTS (Long Term Support) version.
  3. When the file finishes downloading, locate it in your file system and double-click on it.
  4. Go through the entire installation process.
  5. When installation is complete, close the installer. Both Node and NPM will have been installed.
  6. Open Visual Studio Code.
  7. If the Terminal is open, kill it by clicking on the trash can: vs code kill terminal
  8. 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.


Related Articles

  1. Node.js and Node Package Manager (npm) (this article)
  2. How to Install Node.js on a Mac
  3. How to Install Node.js on Windows