# NodeJS

## 🧾 Overview

Node.js runs JavaScript outside the browser for CLIs, APIs, workers, scheduled tasks, and real‑time services. Local installation lets you:

* Install dependencies (npm, pnpm, or Yarn)
* Run and debug before deploying to Discloud
* Prepare builds or bundles where needed

{% embed url="<https://nodejs.org/>" %}

***

## 📥 Installation

Pick your operating system, then one method. Version managers (NVM) help when switching projects.

{% tabs %}
{% tab title="🪟 Windows" %}
{% tabs %}
{% tab title="Installer" %}
{% stepper %}
{% step %}
Open <https://nodejs.org/en/download> and download the LTS .msi
{% endstep %}

{% step %}
Run installer (keep defaults incl. npm + PATH)
{% endstep %}

{% step %}
Reopen terminal & verify

```bash
node -v
npm -v
```

{% endstep %}
{% endstepper %}
{% endtab %}

{% tab title="Chocolatey" %}

```bash
choco install nodejs-lts -y
node -v
npm -v
```

{% endtab %}

{% tab title="NVM for Windows" %}
{% stepper %}
{% step %}
Download latest `nvm-setup.exe` from [releases](https://github.com/coreybutler/nvm-windows/releases)
{% endstep %}

{% step %}
Install accepting defaults
{% endstep %}

{% step %}
Install & use LTS

```bash
nvm install lts 
nvm use lts 
node -v 
npm -v
```

{% endstep %}
{% endstepper %}
{% endtab %}
{% endtabs %}
{% endtab %}

{% tab title="🐧 Linux" %}
{% tabs %}
{% tab title="Debian/Ubuntu" %}

```bash
sudo apt update
sudo apt install -y nodejs npm
node -v
npm -v
```

{% endtab %}

{% tab title="Fedora" %}

```bash
sudo dnf install -y nodejs npm
node -v
npm -v
```

{% endtab %}

{% tab title="Arch" %}

```bash
sudo pacman -S --needed nodejs-lts-hydrogen npm
node -v
npm -v
```

{% endtab %}

{% tab title="NVM" %}

```bash
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
source ~/.bashrc 2>/dev/null || source ~/.zshrc 2>/dev/null
nvm install --lts
nvm use --lts
nvm alias default lts/*
node -v
npm -v
```

{% endtab %}
{% endtabs %}
{% endtab %}

{% tab title="🍎 macOS" %}
{% tabs %}
{% tab title="Installer" %}
Download LTS .pkg from [nodejs.org](https://nodejs.org/en/download) then:

```bash
node -v
npm -v
```

{% endtab %}

{% tab title="Homebrew" %}

```bash
brew update
brew install node
node -v
npm -v
```

{% endtab %}

{% tab title="NVM" %}

```bash
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
source ~/.zshrc 2>/dev/null || source ~/.bashrc 2>/dev/null
nvm install --lts
nvm use --lts
node -v
npm -v
```

{% endtab %}
{% endtabs %}
{% endtab %}
{% endtabs %}

***

## 🔄 Updating Node.js

If you're using **NVM**, you can update Node.js with:

```bash
nvm install stable
```

Otherwise, use your system's package manager or re-download the latest installer from the Node.js website.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.discloud.com/en/development-environment/local-environment/nodejs.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
