可以的,Debian 完全可以运行 Node.js,而且这是非常常见、官方支持的做法。
sudo apt update
sudo apt install nodejs npm
优点:稳定、简单
缺点:版本通常偏旧
查看版本:
node -v
npm -v
例如安装 Node.js 20:
sudo apt update
sudo apt install -y curl
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt install -y nodejs
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
source ~/.bashrc
nvm install 20
nvm use 20
node app.js
pm2systemdnginx + node如果你告诉我:
我可以给你更具体的建议。