Ubuntu – Error executing command, exiting

command linemongodbnodejs

I'm trying to install node.js 12 on Ubuntu 18 and following the instructions, when I type

curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -

I got the next text:

Reading package lists... Done                                                                                                                                                                                     
E: The repository 'http://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/3.4 Release' does not have a Release file.
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.
E: The repository 'http://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/3.0 Release' does not have a Release file.
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.
W: GPG error: http://download.opensuse.org/repositories/isv:/ownCloud:/desktop/Ubuntu_18.10  Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 4ABE1AC7557BEFF9
E: The repository 'http://download.opensuse.org/repositories/isv:/ownCloud:/desktop/Ubuntu_18.10  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.
W: GPG error: http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.6 Release: The following signatures were invalid: EXPKEYSIG 58712A2291FA4AD5 MongoDB 3.6 Release Signing Key <packaging@mongodb.com>
E: The repository 'http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.6 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

I guess this is the reason why every time that I run

sudo apt-get install -y nodejs 

I got the version 8 instead of 10.
Anyone knows why is this happening? How I got to this point?
And if the security of my system is at risk, how to fix it?

Best Answer

You might be having obsolete source PPAs. Remove every other apt sources:

sudo rm -rf /var/lib/apt/lists/*
sudo rm -rf /etc/apt/sources.list.d/*
sudo apt-get update

Then try again.