> ## Documentation Index
> Fetch the complete content index at: https://smallsharpsoftwaretools.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Install Node.js on macOS, Windows, and Linux


[Node.js](https://nodejs.org/) is a JavaScript runtime for server-side programming. It lets you create scalable backend applications and tools using JavaScript.

Command line tools written in JavaScript need Node.js installed on the system in order for them to run. In this tutorial you'll install Node.js on your system so you can use it to run command line tools.

## What You Need

- On macOS, you'll need Homebrew installed, which you can do by following the [Install Homebrew]({{< ref "homebrew" >}}) tutorial.
- On Windows, if you want to use the Linux version of Node.js, you'll need WSL installed, which you can do by following the [Install WSL]({{< ref "wsl" >}}) tutorial.

## Installing Node.js on macOS

Install Node.js on macOS using Homebrew using the following command:

```command
brew install node
```

This installs Node.js and the `npm` package manager.

## Installing Node.js on Ubuntu

To install Node.js, you'll use the [Nodesource](https://github.com/nodesource/distributions/blob/master/README.md) binary distribution, as the built-in version in Ubuntu is often outdated.

The official instructions ask you to download and execute an installation script that adds their repository to your system. Running third-party scripts as the root user, or with elevated permissions, is a bad practice.

To ensure your safety, download the script first and inspect its contents.

First, download the script:

```command
curl -fsSL https://deb.nodesource.com/setup_22.x -o node22.sh
```

View its contents with `less`:

```command
less node22.sh
```

Once you're comfortable with the script's contents, execute the script:

```command
sudo bash node22.sh
```

Once the script completes, install Node.js using `apt`:


```command
sudo apt install -y nodejs
```

This installs both Node.js and the `npm` package management tool.

## Installing Node.js on Windows

On Windows, install Node.js by downloading and running the [official Windows installation tool](https://nodejs.org/en/download).

## Conclusion

WIth Node.js installed, you can now use it to execute a number of powerful command-line tools written in JavaScript and TypeScript.

