Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pin nodejs version on Alpine without building from source

I am trying to install Kibana 6.7.0 on Docker. Base inherited FROM behance/docker-nginx:8.5-alpine Kibana throws an error stating it requires node version 10.15.2 because alpine default offers 10.16.0 from the apk repo.

I tried pinning down node version like this

curl -O https://nodejs.org/download/release/v10.15.2/node-v10.15.2-linux-x64.tar.gz
tar xzf node-v10.15.2-linux-x64.tar.gz

and ENV PATH="/node-v10.15.2-linux-x64/bin:${PATH}"

When I do node -v I get an error saying node /node-v10.15.2-linux-x64/bin/node not found even though it is present.

Is it possible to install node 10.15.2 without building from the source?

like image 284
Hexy Avatar asked Mar 31 '26 00:03

Hexy


1 Answers

No, you have no chance.

In fact although the latest alpine use node10.16, see this, but your alpine version is v3.9, which use node10.14, see this. I don't know if you can use node10.14 to make you work, but you do not have chance to use apk add to install node10.15 version as they even not stored in apk central repo.

And, download prebuilt package like https://nodejs.org/download/release/v10.15.2/node-v10.15.2-linux-x64.tar.gz from official site definitely not work for you. This is because alpine use musl libc while official nodejs binary was built with glibc which is more common libc in linux world. A similar discussion for you reference is here.

As a result, the only solution is to use source to build, you can refer to this to add your things to your dockerfile. Additional, multi-stage builds is preferred in your scenario.

like image 200
atline Avatar answered Apr 02 '26 03:04

atline



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!