Install NodeJS on Windows

If you lot are new to developing with Node.js and desire to get up and running apace then that you can learn, follow the steps below to install Node.js directly on Windows.

Note

If you are using Node.js professionally, observe performance speed and organization call compatibility of import, want to run Docker containers that leverage Linux workspaces and avoid having to maintain both Linux and Windows build scripts, or but prefer using a Fustigate command line, then install Node.js on Windows Subsystem for Linux (more specifically, WSL two).

Install nvm-windows, node.js, and npm

Besides choosing whether to install on Windows or WSL, there are additional choices to make when installing Node.js. We recommend using a version manager as versions change very quickly. You lot 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 commonly chosen nvm, is the nearly pop mode to install multiple versions of Node.js, simply is only bachelor for Mac/Linux and not supported on Windows. Instead, nosotros recommend installing nvm-windows then using information technology to install Node.js and Node Parcel Manager (npm). There are alternative version managers to consider too covered in the next section.

Important

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

  1. Follow the install instructions on the windows-nvm repository. Nosotros recommend using the installer, simply if y'all have a more avant-garde understanding of your needs, you lot may want to consider the manual installation. The installer will point you to the releases folio for the most contempo version.

  2. Download the nvm-setup.cypher file for the near recent release.

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

  4. The Setup-NVM-for-Windows installation wizard volition walk you lot through the setup steps, including choosing the directory where both nvm-windows and Node.js volition exist 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, but more likely to accept bug than the LTS version): nvm install latest

  7. Install the latest stable LTS release of Node.js (recommended) by first looking up what the current LTS version number is with: nvm list available, so installing the LTS version number with: nvm install <version> (replacing <version> with the number, ie: nvm install 12.xiv.0).

    NVM list of available versions

  8. Listing what versions of Node are installed: nvm ls ...now you lot should see the ii versions that you just installed listed.

    NVM list showing installed Node versions

  9. After installing the Node.js version numbers you need, select the version that you would like to use by entering: nvm use <version> (replacing <version> with the number, ie: nvm utilize 12.ix.0).

  10. To alter the version of Node.js yous would like to utilise for a project, create a new project directory mkdir NodeTest, and enter the directory cd NodeTest, then enter nvm use <version> replacing <version> with the version number yous'd like to use (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 current version of Node.js.

Alternative version managers

While windows-nvm is currently the well-nigh popular version director for node, there are alternatives to consider:

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

  • Volta is a new version manager from the LinkedIn squad that claims improved speed and cantankerous-platform back up.

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

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

To learn more virtually using Volta to install multiple versions of Node.js on Windows, see the Volta Docs.

Install Visual Studio Code

Nosotros recommend you install Visual Studio Code, as well as the Node.js Extension Pack, for developing with Node.js on Windows. Install them all or pick and choose which seem the well-nigh useful to you.

To install the Node.js extension pack:

  1. Open up the Extensions window (Ctrl+Shift+Ten) in VS Lawmaking.
  2. In the search box at the summit of the Extensions window, enter: "Node Extension Pack" (or the proper name of whatever extension you are looking for).
  3. Select Install. Once installed, your extension volition appear in the "Enabled" folder of your Extensions window. You can disable, uninstall, or configure settings by selecting the gear icon side by side to the description of your new extension.

A few additional extensions you lot may want to consider include:

  • Debugger for Chrome: One time you terminate developing on the server side with Node.js, you lot'll need to develop and test the client side. This extension integrates your VS Code editor with your Chrome browser debugging service, making things a bit more than efficient.
  • Keymaps from other editors: These extensions can aid your environment feel right at abode if you're transitioning from another text editor (like Atom, Sublime, Vim, eMacs, Notepad++, etc).
  • Settings Sync: Enables you to synchronize your VS Code settings beyond different installations using GitHub. If you lot piece of work on different machines, this helps keep your environment consistent across them.

Culling code editors

If you prefer to utilise a lawmaking editor or IDE other than Visual Studio Code, the following are too good options for your Node.js development environment:

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

Install Git

If you programme to interact with others, or host your project on an open-source site (like GitHub), VS Code supports version control 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 first need to install Git to power the Source Control panel.

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

  2. An Install Wizard is included that volition enquire you a series of questions about settings for your Git installation. We recommend using all of the default settings, unless y'all accept a specific reason for changing something.

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

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

Utilize 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 are fix to build production-prepare web apps, which are typically deployed to a Linux-based server, nosotros recommend using Windows Subsystem for Linux version two (WSL ii) for developing Node.js web apps. Many Node.js packages and frameworks are created with a *nix environment in mind and about Node.js apps are deployed on Linux, so developing on WSL ensures consistency between your development and production environments. To set a WSL dev environment, run across Gear up up your Node.js evolution environment with WSL 2.