What this is
This guide shows how to install Node.js and package managers (npm and Yarn) on a VPS.
Prerequisites
- SSH + sudo
Step-by-step
Ubuntu/Debian (NodeSource)
sudo apt update
sudo apt install -y curl ca-certificates
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt install -y nodejs
Verify Node and npm
node -v
npm -v
Install Yarn (via npm)
sudo npm install -g yarn
yarn -v
Warnings & notes
- Prefer LTS versions of Node for servers.
Conclusion
Node.js and npm/Yarn are installed. Next step: install dependencies and run your app using a process manager.