Ubuntu下安装nodejs 16

Step 1: Install Node.js using NodeSource PPA / NVM

You can install Node.js 16 on Ubuntu 22.04|20.04|18.04 from either:

  • NodeSource PPA Repository
  • Using NVM Manager

Method 1) Install Node.js 16 on Ubuntu from NodeSource PPA Repository

To install any version of Node.js you can use a PPA (personal package archive) which is maintained by Nodesource. These PPAs have a lot more versions of Nodejs as compared to the official Ubuntu repositories. First, we will need to install the PPA in order to install Node.js 16. From your home directory, use the cURL command. Install cURL in case you haven’t installed it using sudo apt install curl .

cd ~
curl -sL https://deb.nodesource.com/setup_16.x | sudo bash -

This command creates APT sources list for Nodesource Nodejs 16 repo which can be viewed as below.

# sample on Ubuntu 20.04
$ cat /etc/apt/sources.list.d/nodesource.list
deb https://deb.nodesource.com/node_16.x focal main
deb-src https://deb.nodesource.com/node_16.x focal main

With the repository added successfully, you can now install Node.js 16 on Ubuntu 22.04/20.04/18.04 with the command:

sudo apt -y install nodejs

Once installed, verify the version of Node.js.

$ node  -v
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值