# How to install Node.js

> Learn how to install Node.js with a version manager or the official installer, choose an LTS release, verify Node and npm, and switch project versions.

Author: [Flavio Copes](https://flaviocopes.com/about/) | Published: 2018-08-13 | Updated: 2026-07-18 | Topics: [Node.js](https://flaviocopes.com/tags/node/) | Canonical: https://flaviocopes.com/node-installation/

The best way to install Node.js for development is usually a version manager. It lets you install more than one Node release and switch between them for different projects.

If you only need one version, you can use an installer from the official [Node.js download page](https://nodejs.org/en/download).

For most production work, choose an active Long Term Support release rather than the Current release. The exact supported releases change over time, so check the [Node.js release schedule](https://nodejs.org/en/about/previous-releases).

## Install Node.js with nvm

`nvm` is a popular version manager for macOS, Linux, and Windows Subsystem for Linux. It does not support native Windows shells.

Use the install command published in the official [nvm repository](https://github.com/nvm-sh/nvm). The command includes the current nvm release, so copy it from the repository instead of relying on an old version in a tutorial.

After installing nvm, open a new terminal and install the latest LTS release:

```bash
nvm install --lts
nvm use --lts
```

The first version installed becomes the default in new shells. You can also set it explicitly:

```bash
nvm alias default 'lts/*'
```

List the Node versions installed on your machine:

```bash
nvm ls
```

List releases available to install:

```bash
nvm ls-remote --lts
```

## Pin the Node version for a project

Create an `.nvmrc` file in the project root:

```text
lts/*
```

Then run:

```bash
nvm install
nvm use
```

A team can put a specific supported release line in `.nvmrc` when it needs reproducible local and CI environments. Update that file as part of normal dependency maintenance.

## Use the official installer

The [Node.js download page](https://nodejs.org/en/download) provides installers and prebuilt binaries.

This is simple, but switching between Node releases later is less convenient than with a version manager. Avoid installing Node from an unofficial download site.

## Verify the installation

Node includes npm. Check both commands:

```bash
node --version
npm --version
```

You can now run a JavaScript file:

```bash
node app.js
```

If your shell says `node: command not found`, restart the terminal and check the setup instructions printed by your installer or version manager. Do not use `sudo` to work around npm permission errors; fix the Node installation or use a per-user version manager instead.
