ubuntu20安装nodejs报错:由于没有公钥,无法验证下列签名

坍缩协程
• 阅读 2653

在 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
点赞
收藏
评论区
推荐文章
blmius blmius
3年前
MySQL:[Err] 1292 - Incorrect datetime value: ‘0000-00-00 00:00:00‘ for column ‘CREATE_TIME‘ at row 1
文章目录问题用navicat导入数据时,报错:原因这是因为当前的MySQL不支持datetime为0的情况。解决修改sql\mode:sql\mode:SQLMode定义了MySQL应支持的SQL语法、数据校验等,这样可以更容易地在不同的环境中使用MySQL。全局s
Wesley13 Wesley13
3年前
MySQL部分从库上面因为大量的临时表tmp_table造成慢查询
背景描述Time:20190124T00:08:14.70572408:00User@Host:@Id:Schema:sentrymetaLast_errno:0Killed:0Query_time:0.315758Lock_
美凌格栋栋酱 美凌格栋栋酱
6个月前
Oracle 分组与拼接字符串同时使用
SELECTT.,ROWNUMIDFROM(SELECTT.EMPLID,T.NAME,T.BU,T.REALDEPART,T.FORMATDATE,SUM(T.S0)S0,MAX(UPDATETIME)CREATETIME,LISTAGG(TOCHAR(
Wesley13 Wesley13
3年前
VBox 启动虚拟机失败
在Vbox(5.0.8版本)启动Ubuntu的虚拟机时,遇到错误信息:NtCreateFile(\\Device\\VBoxDrvStub)failed:0xc000000034STATUS\_OBJECT\_NAME\_NOT\_FOUND(0retries) (rc101)Makesurethekern
Wesley13 Wesley13
3年前
FLV文件格式
1.        FLV文件对齐方式FLV文件以大端对齐方式存放多字节整型。如存放数字无符号16位的数字300(0x012C),那么在FLV文件中存放的顺序是:|0x01|0x2C|。如果是无符号32位数字300(0x0000012C),那么在FLV文件中的存放顺序是:|0x00|0x00|0x00|0x01|0x2C。2.  
Wesley13 Wesley13
3年前
mysql设置时区
mysql设置时区mysql\_query("SETtime\_zone'8:00'")ordie('时区设置失败,请联系管理员!');中国在东8区所以加8方法二:selectcount(user\_id)asdevice,CONVERT\_TZ(FROM\_UNIXTIME(reg\_time),'08:00','0
Wesley13 Wesley13
3年前
PHP创建多级树型结构
<!lang:php<?php$areaarray(array('id'1,'pid'0,'name''中国'),array('id'5,'pid'0,'name''美国'),array('id'2,'pid'1,'name''吉林'),array('id'4,'pid'2,'n
Wesley13 Wesley13
3年前
Java日期时间API系列36
  十二时辰,古代劳动人民把一昼夜划分成十二个时段,每一个时段叫一个时辰。二十四小时和十二时辰对照表:时辰时间24时制子时深夜11:00凌晨01:0023:0001:00丑时上午01:00上午03:0001:0003:00寅时上午03:00上午0
Stella981 Stella981
3年前
Node.js 中使用 ECDSA 签名遇到的坑
文/Fenying最近有个朋友问我关于Node.js下使用ECDSA的问题,主要是使用Node.js的Crypto模块无法校验网络传输过来的签名结果。在踩坑无数后,终于搞清楚了原因。坑0x00:签名输出格式在排除了证书、消息不一致的可能之后,我开始对比使用Node.js签名的结果与网络传输过来的签
Wesley13 Wesley13
3年前
MBR笔记
<bochs:100000000000e\WGUI\Simclientsize(0,0)!stretchedsize(640,480)!<bochs:2b0x7c00<bochs:3c00000003740i\BIOS\$Revision:1.166$$Date:2006/08/1117
坍缩协程
坍缩协程
Lv1
自卑溢出来就变成了安静和温柔。
文章
4
粉丝
0
获赞
0