遵循https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-ubuntu-20-04中的选项 2 :
$ 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,它不受支持和维护。我在使用此版本时遇到问题,现在无法将其升级到当前版本。
需要注意的是,精确是指 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。