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
- Open a terminal in Visual Studio Code by selecting Terminal from the View menu:
- At the terminal, run
At the terminal, run
$ node -v v16.16.0
$ npm -v 8.15.0
- 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.
- Go to nodejs.org. You'll see download links for your operating system:
- 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.
- When the file finishes downloading, locate it in your file system and double-click on it.
- Go through the entire installation process.
- When installation is complete, close the installer. Both Node and NPM will have been installed.
- Open Visual Studio Code.
- If the Terminal is open, kill it by clicking on the trash can:
- 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.
- Node.js and Node Package Manager (npm) (this article)
- How to Install Node.js on a Mac
- How to Run a Node.js Application on Windows
- How to Send and Receive JSON Data to and from the Server
- How to Run a Node.js Application on a Mac
- How to Install Node.js on Windows