在Debian上安装Node.js最新版本,可以使用NodeSource存储库
打开终端。
首先,确保系统已安装了必要的软件包,如curl
和build-essential
。如果尚未安装,请运行以下命令:
sudo apt update
sudo apt install curl build-essential
<version>
替换为您要安装的Node.js版本,例如16.x
:curl -fsSL https://deb.nodesource.com/setup_<version> | sudo -E bash -
例如,要安装Node.js 16.x,请运行:
curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt install -y nodejs
node --version
npm --version
现在,您已经在Debian上安装了Node.js的最新LTS版本。如果您想安装其他版本,只需在步骤3中将<version>
替换为所需的版本即可。
亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>