Install NodeJS on Windows

If yous are new to developing with Node.js and want to get up and running quickly so that you can learn, follow the steps below to install Node.js directly on Windows.

Note

If you are using Node.js professionally, find performance speed and system call compatibility important, want to run Docker containers that leverage Linux workspaces and avoid having to maintain both Linux and Windows build scripts, or just prefer using a Bash command line, and then install Node.js on Windows Subsystem for Linux (more specifically, WSL 2).

Install nvm-windows, node.js, and npm

Likewise choosing whether to install on Windows or WSL, there are additional choices to make when installing Node.js. Nosotros recommend using a version director equally versions modify very quickly. You will likely need to switch between multiple Node.js versions based on the needs of different projects you're working on. Node Version Manager, more than commonly chosen nvm, is the near popular manner to install multiple versions of Node.js, but is only bachelor for Mac/Linux and not supported on Windows. Instead, nosotros recommend installing nvm-windows then using it to install Node.js and Node Package Managing director (npm). There are alternative version managers to consider as well covered in the next section.

Important

It is ever recommended to remove whatever existing installations of Node.js or npm from your operating organization earlier installing a version manager as the dissimilar types of installation can lead to strange and confusing conflicts. This includes deleting any existing nodejs installation directories (e.g., "C:\Program Files\nodejs") that might remain. NVM's generated symlink will not overwrite an existing (even empty) installation directory. For help with removing previous installations, see How to completely remove node.js from Windows.)

  1. Follow the install instructions on the windows-nvm repository. We recommend using the installer, just if you have a more advanced understanding of your needs, you may want to consider the manual installation. The installer volition point you lot to the releases page for the most recent version.

  2. Download the nvm-setup.zip file for the most recent release.

  3. Once downloaded, open the zip file, then open the nvm-setup.exe file.

  4. The Setup-NVM-for-Windows installation wizard will walk you lot through the setup steps, including choosing the directory where both nvm-windows and Node.js will be installed.

    NVM for Windows installation wizard

  5. One time the installation is complete. Open PowerShell (recommend opening with elevated Admin permissions) and effort using windows-nvm to list which versions of Node are currently installed (should be none at this signal): nvm ls

    NVM list showing no Node versions

  6. Install the current release of Node.js (for testing the newest feature improvements, just more likely to have bug than the LTS version): nvm install latest

  7. Install the latest stable LTS release of Node.js (recommended) by offset looking upward what the current LTS version number is with: nvm list available, then installing the LTS version number with: nvm install <version> (replacing <version> with the number, ie: nvm install 12.14.0).

    NVM list of available versions

  8. Listing what versions of Node are installed: nvm ls ...now you should see the two versions that you only installed listed.

    NVM list showing installed Node versions

  9. After installing the Node.js version numbers y'all demand, select the version that you would like to use past entering: nvm use <version> (replacing <version> with the number, ie: nvm use 12.9.0).

  10. To change the version of Node.js you would like to use for a project, create a new projection directory mkdir NodeTest, and enter the directory cd NodeTest, then enter nvm employ <version> replacing <version> with the version number you'd like to employ (ie v10.16.3`).

  11. Verify which version of npm is installed with: npm --version, this version number will automatically change to whichever npm version is associated with your electric current version of Node.js.

Alternative version managers

While windows-nvm is currently the most pop version manager for node, there are alternatives to consider:

  • nvs (Node Version Switcher) is a cross-platform nvm alternative with the ability to integrate with VS Code.

  • Volta is a new version manager from the LinkedIn squad that claims improved speed and cross-platform support.

To install Volta as your version manager (rather than windows-nvm), get to the Windows Installation section of their Getting Started guide, then download and run their Windows installer, following the setup instructions.

Of import

Yous must ensure that Programmer Mode is enabled on your Windows machine before installing Volta.

To learn more well-nigh using Volta to install multiple versions of Node.js on Windows, encounter the Volta Docs.

Install Visual Studio Code

We recommend you install Visual Studio Code, as well equally the Node.js Extension Pack, for developing with Node.js on Windows. Install them all or selection and choose which seem the most useful to you.

To install the Node.js extension pack:

  1. Open up the Extensions window (Ctrl+Shift+Ten) in VS Code.
  2. In the search box at the top of the Extensions window, enter: "Node Extension Pack" (or the proper noun of whatsoever extension you are looking for).
  3. Select Install. Once installed, your extension will appear in the "Enabled" folder of your Extensions window. You tin can disable, uninstall, or configure settings by selecting the gear icon next to the clarification of your new extension.

A few boosted extensions you may want to consider include:

  • Debugger for Chrome: In one case you lot finish developing on the server side with Node.js, you lot'll need to develop and examination the customer side. This extension integrates your VS Lawmaking editor with your Chrome browser debugging service, making things a bit more efficient.
  • Keymaps from other editors: These extensions tin can assist your environs feel right at dwelling if you're transitioning from another text editor (similar Atom, Sublime, Vim, eMacs, Notepad++, etc).
  • Settings Sync: Enables yous to synchronize your VS Code settings across different installations using GitHub. If y'all work on different machines, this helps keep your environment consequent beyond them.

Alternative code editors

If yous prefer to use a code editor or IDE other than Visual Studio Code, the following are also good options for your Node.js evolution environment:

  • IntelliJ Thought
  • Sublime Text
  • Atom
  • Brackets
  • Notepad++

Install Git

If you lot programme to collaborate with others, or host your project on an open-source site (like GitHub), VS Lawmaking supports version command with Git. The Source Control tab in VS Code tracks all of your changes and has common Git commands (add, commit, push, pull) built right into the UI. You offset need to install Git to power the Source Control console.

  1. Download and install Git for Windows from the git-scm website.

  2. An Install Sorcerer is included that volition ask you lot a series of questions most settings for your Git installation. We recommend using all of the default settings, unless y'all have a specific reason for changing something.

  3. If you've never worked with Git before, GitHub Guides can help you get started.

  4. We recommend adding a .gitignore file to your Node projects. Hither is GitHub's default gitignore template for Node.js.

Use Windows Subsystem for Linux for production

Using Node.js directly on Windows is great for learning and experimenting with what y'all can do. Once you lot are gear up to build production-ready web apps, which are typically deployed to a Linux-based server, nosotros recommend using Windows Subsystem for Linux version 2 (WSL 2) for developing Node.js web apps. Many Node.js packages and frameworks are created with a *nix environment in listen and most Node.js apps are deployed on Linux, then developing on WSL ensures consistency betwixt your development and product environments. To set upwardly a WSL dev environment, come across Fix your Node.js evolution environment with WSL 2.