Install Node.js 4 on Alpine Linux
Solution 1
Use this to list available packages:
apk search --update 'node*'
choose one and install it as next:
apk add nodejs-lts --update
(1/4) Installing libgcc (5.3.0-r0)
(2/4) Installing libstdc++ (5.3.0-r0)
(3/4) Installing libuv (1.9.1-r0)
(4/4) Installing nodejs-lts (4.4.4-r0)
Solution 2
Alpine is a rolling release distro. Packages for nodejs are dependent from which version of alpine you are using.
In your example, if you need nodejs-4.3x, you should use Alpine 3.3:
https://pkgs.alpinelinux.org/packages?name=nodejs&branch=&repo=&arch=&maintainer=
This because there is no way yet to install arbitrary an older versions of a package from official repositories.
A possible workaround, if it might be fitting for you, is using an lxc container, where you can specify the alpine version to use, with a small footprint on the host.
Related videos on Youtube
AndreKR
Updated on September 18, 2022Comments
-
AndreKR almost 2 years
I am new to Alpine Linux and I tried to install Node.js 4.
According to this I can specify the version like this:
apk add nodejs=4
I also tried this because I though maybe it doesn't understand semantic versions and I saw here that
4.3.0-r0
seems to be the only available version:apk add nodejs=4.3.0-r0
Both commands lead to an error:
ERROR: unsatisfiable constraints: nodejs-6.2.0-r0: breaks: world[nodejs=4.3.0-r0]
What am I doing wrong?
-
Eazy almost 7 yearsAlpine is not a rolling release distro. Only edge branch is rolling.
-
Eazy almost 7 yearsIt’s named
nodejs-lts
only in v3.4, it’s justnodejs
in further versions ornodejs-current
for the “current” version (that’s the upstream’s terminology, it’s non-LTS version).