Instalacja Node.js na serwerze VPS (Ubuntu)
Metoda zalecana: NVM (Node Version Manager)
NVM pozwala łatwo przełączać wersje Node.js.
# Instalacja NVM
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
# Załaduj NVM do bieżącej sesji
source ~/.bashrc
# Zainstaluj najnowszą stabilną wersję Node.js
nvm install --lts
# Sprawdź wersję
node -v
npm -v
Metoda alternatywna: APT (szybsza)
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt install -y nodejs
Instalacja zależności projektu
cd /sciezka/do/bota
npm install
Uruchomienie z PM2
npm install -g pm2
pm2 start index.js --name "bot"
pm2 save
pm2 startup