在 ubuntu20 中的 node 太 old 了,是 14
我想装置一个 16
就找了一个教程, 应用了上面的命令:
curl -s https://deb.nodesource.com/setup_16.x | sudo bash
而后 sudo apt update
, 然而遇到了上面的报错:
╰─➤ sudo apt update
命中:1 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal InRelease
命中:2 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates InRelease
命中:3 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-backports InRelease
命中:4 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-security InRelease
获取:5 https://deb.nodesource.com/node_16.x focal InRelease [4,583 B]
谬误:5 https://deb.nodesource.com/node_16.x focal InRelease
因为没有公钥,无奈验证下列签名:NO_PUBKEY 1655A0AB68576280
正在读取软件包列表... 实现
W: GPG 谬误:https://deb.nodesource.com/node_16.x focal InRelease: 因为没有公钥,无奈验证下列签名:NO_PUBKEY 1655A0AB68576280
E: 仓库“https://deb.nodesource.com/node_16.x focal InRelease”没有数字签名。N: 无奈平安地用该源进行更新,所以默认禁用该源。N: 参见 apt-secure(8) 手册以理解仓库创立和用户配置方面的细节。
而后我是怎么解决的?
其实就是少打了一个 -
sudo rm sources.list.d/nodesource.list
删掉谬误的后果
谬误的命令:curl -s https://deb.nodesource.com/setup_16.x | sudo bash
正确的命令:curl -sL https://deb.nodesource.com/setup_16.x | sudo bash -
后果如下:
─➤ curl -sL https://deb.nodesource.com/setup_16.x | sudo bash - 1 ↵
## Installing the NodeSource Node.js 16.x repo...
## Populating apt-get cache...
+ apt-get update
命中:1 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal InRelease
命中:2 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates InRelease
命中:3 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-backports InRelease
命中:4 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-security InRelease
正在读取软件包列表... 实现
## Confirming "focal" is supported...
+ curl -sLf -o /dev/null 'https://deb.nodesource.com/node_16.x/dists/focal/Release'
## Adding the NodeSource signing key to your keyring...
+ curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | gpg --dearmor | tee /usr/share/keyrings/nodesource.gpg >/dev/null
## Creating apt sources list file for the NodeSource Node.js 16.x repo...
+ echo 'deb [signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_16.x focal main' > /etc/apt/sources.list.d/nodesource.list
+ echo 'deb-src [signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_16.x focal main' >> /etc/apt/sources.list.d/nodesource.list
## Running `apt-get update` for you...
+ apt-get update
命中:1 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal InRelease
命中:2 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates InRelease
命中:3 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-backports InRelease
命中:4 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-security InRelease
获取:5 https://deb.nodesource.com/node_16.x focal InRelease [4,583 B]
获取:6 https://deb.nodesource.com/node_16.x focal/main amd64 Packages [774 B]
已下载 5,357 B,耗时 7 秒 (744 B/s)
正在读取软件包列表... 实现
## Run `sudo apt-get install -y nodejs` to install Node.js 16.x and npm
## You may also need development tools to build native addons:
sudo apt-get install gcc g++ make
## To install the Yarn package manager, run:
curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | sudo tee /usr/share/keyrings/yarnkey.gpg >/dev/null
echo "deb [signed-by=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update && sudo apt-get install yarn