Back to site

Install Node.js (LTS)

Install Node.js LTS on a HolyCloud VPS via NodeSource or nvm, and verify node and npm.

Install Node.js (LTS)

Node.js LTS suits web apps (Express, NestJS), frontend tooling (Vite), and scripts. On a HolyCloud VPS, prefer NodeSource for a stable system service, or nvm if you manage several versions per user.

Prerequisites

  • HolyCloud Linux VPS Ubuntu 22.04/24.04 or Debian 12
  • sudo access (NodeSource) or dedicated user (nvm)
  • Stable SSH connection

Tip: avoid Debian repo Node alone (apt install nodejs) — it is often too old for recent projects.

Install prerequisites:

sudo apt update
sudo apt install -y ca-certificates curl gnupg

Add the Node.js 22.x LTS repository (check current version at https://github.com/nodesource/distributions):

curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
sudo apt install -y nodejs

Verify:

node --version
npm --version
which node

Later upgrade:

sudo apt update && sudo apt install --only-upgrade nodejs

Method B: nvm (multiple versions per user)

Install nvm for the user running the app (e.g. deploy):

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
source ~/.bashrc
nvm install --lts
nvm use --lts
nvm alias default 'lts/*'

Verify:

node -v
npm -v
nvm current

For a project with .nvmrc:

echo "22" > .nvmrc
nvm install

Step 2: useful global tools

With NodeSource (sudo) or nvm (nvm globals without sudo):

sudo npm install -g pm2
pm2 --version

pm2 keeps a Node app running after SSH disconnect:

pm2 start app.js --name monapp
pm2 save
pm2 startup

Step 3: minimal test

Create a test HTTP server:

mkdir -p ~/test-node && cd ~/test-node
npm init -y
npm install express
cat > server.js <<'EOF'
const express = require('express');
const app = express();
app.get('/', (req, res) => res.send('Node OK sur HolyCloud'));
app.listen(3000, '127.0.0.1', () => console.log('http://127.0.0.1:3000'));
EOF
node server.js

In another terminal:

curl -s http://127.0.0.1:3000

Nginx reverse proxy to port 3000 if you expose the site over HTTPS (see Nginx/Certbot guide).

Verification

| Command | Expected |

|----------|---------|

| node --version | v22.x.x or chosen LTS |

| npm --version | 10.x or higher |

| npm doctor | No critical errors |

Disk space for node_modules:

df -h /
du -sh ~/test-node/node_modules

Need help?

HolyCloud support can confirm VPS connectivity and resources; npm/project errors remain on the application side.