安装 Nodejs 时出错

安装 Nodejs 时出错

按照选项 2https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-ubuntu-20-04

$ cd ~
$ curl -sL https://deb.nodesource.com/setup_16.x -o nodesource_setup.sh
$ sudo bash nodesource_setup.sh

我收到错误:


## Installing the NodeSource Node.js 16.x repo...


## Populating apt-get cache...

+ apt-get update
Hit:1 http://repo.mysql.com/apt/ubuntu focal InRelease
Hit:2 http://np.archive.ubuntu.com/ubuntu focal InRelease                                                                            
Hit:3 http://security.ubuntu.com/ubuntu focal-security InRelease                                                                     
Ign:4 http://oem.archive.canonical.com/updates precise-oem-sp1 InRelease                                                             
Get:5 http://oem.archive.canonical.com/updates precise-oem-sp1 Release [4,325 B]                                                     
Hit:6 http://np.archive.ubuntu.com/ubuntu focal-updates InRelease                                                                    
Get:7 http://oem.archive.canonical.com/updates precise-oem-sp1 Release.gpg [287 B]                                                   
Ign:7 http://oem.archive.canonical.com/updates precise-oem-sp1 Release.gpg                                                           
Hit:8 https://repo.skype.com/deb stable InRelease                                                                                    
Hit:9 http://np.archive.ubuntu.com/ubuntu focal-backports InRelease                                                                  
Hit:11 https://download.sublimetext.com apt/stable/ InRelease                                         
Hit:10 https://packagecloud.io/slacktechnologies/slack/debian jessie InRelease
Reading package lists... Done                            
W: GPG error: http://oem.archive.canonical.com/updates precise-oem-sp1 Release: Detached signature file '/var/lib/apt/lists/partial/oem.archive.canonical.com_updates_dists_precise-oem-sp1_Release.gpg' is in unsupported binary format
E: The repository 'http://oem.archive.canonical.com/updates precise-oem-sp1 Release' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
Error executing command, exiting

您能帮我解决这个问题吗?我无法继续,因为默认的 nodejs 是 10.19,它不受支持且不受维护。我遇到了这个版本的问题,现在无法将其升级到当前版本。

答案1

应当指出的是精确的表示 Ubuntu Precise Pangolin 12.04 LTS 于 2012 年 4 月发布,因此它是 EOL。

因此,您必须手动编辑您的/etc/apt/sources.list文件(或来自的其他*.list文件),并通过在行开头添加/etc/apt/sources.list.d/来注释掉行。precise-oem-sp1#

然后运行sudo apt-get update,确保此操作期间没有错误,最后继续 NodeJS 安装。

相关内容