Getting error while installing Nodejs

Following the Option 2 from https://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

I am getting the error :


## 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

Could you please help me through the issue ? I am not able to move forward as the nodejs from default is 10.19, which is not unsupported & unmaintained. I am having issues with this version, and am now not able to upgrade it to the current version.


Solution 1:

It should be noted that precise means Ubuntu Precise Pangolin 12.04 LTS which were released in April of 2012 year, so it is EOL.

Thus you have to manually edit your /etc/apt/sources.list file (or some other *.list file from /etc/apt/sources.list.d/) and comment out lines with precise-oem-sp1 by putting # at their start.

Then run sudo apt-get update, ensure that there are no errors during this operation and finally proceed with NodeJS installation.