nullpointer
nullpointer

Reputation: 532

Install a specific nodejs version with apt-get

I am a newbie with Linux general, and here's what I am trying to achieve:

I am trying to install nodejs version on Debian Linux with the following command:

apt-get install nodejs=8.14.0

But I get this error in return:

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

As far as I found, this is the correct way to specify a version. If I do this, then it works fine:

apt-get install nodejs

But I need this specific version, and not the latest one. I am doing this for a Docker image, so it has to be installed at runtime.

Upvotes: 11

Views: 32365

Answers (3)

Munish
Munish

Reputation: 1637

Make sure you have the following packages:-

sudo apt-get install \
    apt-transport-https \
    curl \
    software-properties-common

Enable the NodeSource repository by using a command:-

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

After enabling the repository, install Node.js using a command:-

sudo apt-get install nodejs

Upvotes: 13

user344450
user344450

Reputation:

If you're doing this for a Docker image, why not just use the Node Docker image with the version you need?

Upvotes: 2

Charles. Hi
Charles. Hi

Reputation: 119

You can try installing your node using a package manager like nvm:

Installing Node.js to linux

Or download the binaries directly from here: Node.js v8.14.0

Upvotes: -1

Related Questions