If you’re new to developing with Node.js and want to get up and running quickly so you can learn, follow the steps below to install Node.js directly on Windows.
Install nvm-windows, node.js and npm
In addition to choosing whether to install on Windows or WSL, there are additional options that can be taken when installing Node.js. We recommend using a version manager as versions change very quickly. You’ll likely have to switch between multiple Node.js versions based on the needs of different projects you’re working on. Node Version Manager, more commonly called nvm, is the most popular way to install various versions of Node.js, but it is only available for Mac/Linux and is not compatible with Windows. Instead, we recommend installing nvm-windows and then using it to install Node.js and Node Package Manager (npm). There are alternate version managers to consider also covered in the next section.
-
Follow the installation instructions in the windows-nvm repository. We recommend using the installer, but if you have a more advanced understanding of your needs, you may want to consider manual installation. The installer will direct you to the versions page for the latest version.
-
, and then open the nvm-setup.exe file
-
The Setup-NVM-for-Windows installation wizard will guide you through the configuration steps, including choosing the directory where nvm-windows and Node will be installed.js
-
.
-
After the installation is complete. Open PowerShell (it is recommended to open with elevated administrator permissions) and try using windows-nvm to list which versions of Node are currently installed (there should be none at this time): nvm
-
current version of Node.js (to test the latest feature improvements, but more likely to have issues than the LTS version): nvm
-
Install the latest stable version of Node LTS.js (recommended) by first looking for the current LTS version number with: nvm list available, then install the LTS version number with: nvm install <version> (replacing <version> with the number, i.e.: nvm install 12.14.0).
-
List which versions of Node are installed: NVM LS … You should now see the two versions you just installed in the list.
-
After installing the Node.js version numbers you need, select the version you want to use by entering: nvm use <version> (replacing <version> with the number, i.e. nvm use 12.9.0).
Download the nvm-setup.zip file for the latest version. Once downloaded, open the zip file
.
ls Install the
install latest
To change the Node version.js you want to use for a project,
-
create a new mkdir NodeTest project directory and enter the cd NodeTest directory, then enter nvm use <version> replacing <version> with the version number you would like to use (i.e. v10.16.3′).
-
Check which version of npm is installed with: npm -version, this version number will automatically change to any version of npm associated with your current version of Node.js.
While
windows-nvm is currently the most popular 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 team that claims improved speed and cross-platform support.
.
To install Volta
as your version manager (instead of windows-nvm), go to the Windows Installation section of your getting started guide, then download and run your Windows installer, following the setup instructions
.
For more information about using Volta to install multiple versions of Node.js on Windows, see Volta Docs.
Install
Visual Studio Code
We recommend that you install Visual Studio Code, as well as Node.js Extension Pack, to develop with Node.js on Windows. Install them all or pick and choose the one you find most useful.
To install the extension pack
Node.js: Open the
- Extensions window (Ctrl+Shift+X) in VS Code
- In the search box at the top of the Extensions window, type: “Node Extension Pack” (or the name of the extension you are looking for).
- Select Install. Once installed, the extension will appear in the “Enabled” folder of the Extensions window. You can disable, uninstall or configure the settings by selecting the gear icon next to the description of your new extension.
.
Some additional extensions you may consider include
:
- Debugger for Chrome: Once you’re done developing server-side with Node.js, you’ll need to develop and test client-side. This extension integrates your VS Code editor with your Chrome browser’s debugging service, which makes things a little more efficient.
- Keymaps from other editors: These extensions can help your environment feel at home if you’re transitioning from another text editor (such as Atom, Sublime, Vim, eMacs, Notepad++, etc.).
- Configuration Sync: Allows you to sync VS Code settings across different installations using GitHub. If you work on different machines, this helps keep your environment consistent across all machines.
Alternative code editors
If you
prefer to use a code editor or IDE other than Visual Studio Code, the following are also good choices for your .js Node development environment:
- IntelliJ IDEA
- Sublime
- Atom
- of text Notepad
- ++
text
supports
Install Git If you plan to collaborate with others or host your project on an open source site (such as GitHub), VS Code supports versioning with
Git
. The VS Code Source Control tab tracks all changes and has common Git (add, commit, insert, extract) commands built right into the UI. You must first install Git to power the source code control panel.
-
Download and install Git for Windows from the git-scm website
-
An installation wizard is included that will ask you a series of questions about configuring your Git installation. We recommend using all default settings, unless you have a specific reason to change something.
-
If you’ve never worked with Git before, GitHub Guides can help you get started
-
We recommend that you add a .gitignore file to your Node projects. Here is GitHub’s default gitignore template for Node.js.
.
.
Using
the Windows Subsystem
for Linux for Production
Using Node.js directly in Windows is great for learning and experimenting with what you can do. Once you are ready to create production-ready web applications, which are typically deployed to a Linux-based server, we recommend that you use the Windows Subsystem for Linux version 2 (WSL 2) to develop web applications .js Node. Many Node.js packages and frameworks are built with a *nix environment in mind and most Node.js applications are deployed on Linux, so WSL development ensures consistency between development and production environments. To set up a WSL development environment, see Set up your Node.js development environment with WSL 2.