Install / downgrade specific version of Node.js [duplicate]

I have this:

RUN curl -sL | sudo -E bash -
RUN apt-get install -y nodejs=11

but I get:

E: Version '11' for 'nodejs' was not found

I also tried:

RUN apt-get install -y nodejs=11*

does anyone know how I can find out which versions are available? The problem is that node version 12 is already installed on this machine and I want to downgrade the Node.js version here.

0

3 Answers

Because 12 is already installed, I had to do this:

# apt-get remove -y nodejs # key part
# curl -sL | sudo -E bash -
# apt-get install -y nodejs

just drop that =11 part. Like this:

sudo apt install nodejs

and

node -v
v11.15.0

The reason is that first curl command installs the repository which replaces apt's pointer for nodejs - so no need to specify the version.

2

try like this:

curl -sL | sudo -E bash -
sudo apt-get install -y nodejs

the only problem that I see is the "nodejs=11" in the apt-get, that should do it.

You can find the versions here:

The stable version is currently the 10.x

2

You Might Also Like