1

Thank you for joining, I need some help, this could be easy but I'm new to linux. I want to install NodeJS latest version by following the guide posted here, as the version my official sourcelist gives me is very old.

https://github.com/nodesource/distributions/blob/master/README.md#debmanual

These are the suggested commands:

curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
sudo apt-get install -y nodejs

But the problem is the old version gets installed instead..

sudo apt list nodejs

Listing... Done
nodejs/unknown 18.0.0-deb-1nodesource1 amd64
nodejs/oldstable,oldstable 10.24.0~dfsg-1~deb10u1 i386

apt-cache policy nodejs
nodejs:
  Installed: (none)
  Candidate: 10.24.0~dfsg-1~deb10u1
  Version table:
     10.24.0~dfsg-1~deb10u1 500
        500 http://ftp.debian.org/debian buster/main i386 Packages
        500 http://security.debian.org buster/updates/main i386 Packages

This is my OS: OS: Distributor ID: Debian Description: Debian GNU/Linux 10 (buster) Release: 10 Codename: buster

I tried using sudo apt-get nodejs=<version> but it failed for the new 18 version yet worked for the old one.

1 Answer 1

1

I tried to run your commands and it fails because it runs all the needed commands once time. So, it doesn't install the repos, and then when you try to search it found the old version of nodejs.

Try to run the following commands separately:

$ curl -s https://deb.nodesource.com/setup_16.x | sudo bash
$ sudo apt install -y nodejs

Otherwise, I suggest using NVM (https://github.com/nvm-sh/nvm) which allows you to install different versions of nodejs

2
  • Thank you very much for taking the time to give me some help. Somehow while posting this issue pressing enter only once did not move the text to the new line, all of the code is executed one by one as you said. Did the sequence work for you? To me it gives these intermitent errors after the CURL command (seemingly at random, sometimes is one of them other times is the other): ERR1: The following signatures couldn't be verified because the public key is not available: ERR2: The repository 'deb.nodesource.com/nodejs_16.x buster Release' does not have a Release file. Commented Apr 25, 2022 at 11:54
  • Also this is my OS: Distributor ID: Debian Description: Debian GNU/Linux 10 (buster) Release: 10 Codename: buster Commented Apr 25, 2022 at 11:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .