Linux安装nodejs

Linux各版本

Node.js v18.x:

使用 Ubuntu

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

使用 Debian, as root

curl -fsSL https://deb.nodesource.com/setup_18.x | bash -
apt-get install -y nodejs

Node.js v16.x:

使用 Ubuntu

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

使用 Debian, as root

curl -fsSL https://deb.nodesource.com/setup_16.x | bash -
apt-get install -y nodejs

Node.js v14.x:

使用 Ubuntu

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

使用 Debian

curl -fsSL https://deb.nodesource.com/setup_14.x | bash -
apt-get install -y nodejs

Node.js LTS (v16.x):

使用 Ubuntu

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

使用 Debian

curl -fsSL https://deb.nodesource.com/setup_lts.x | bash -
apt-get install -y nodejs

Node.js 当前 (v18.x):

使用 Ubuntu

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

使用 Debian

curl -fsSL https://deb.nodesource.com/setup_current.x | bash -
apt-get install -y nodejs

可选:安装构建工具

要从 npm 编译和安装本机插件,您可能还需要安装构建工具:

使用 Debian

apt-get install -y build-essential

卸载nodejsUbuntu 和 Debian 软件包

要完全删除从上述 deb.nodesource.com 包方法安装的 Node.js:

使用 Debian或者Ubuntu

apt-get purge nodejs
rm -r /etc/apt/sources.list.d/nodesource.list

消息盒子
# 您需要首次评论以获取消息 #
# 您需要首次评论以获取消息 #

只显示最新10条未读和已读信息