DEV Community

Ajeet Singh Raina
Ajeet Singh Raina

Posted on • Updated on

Installing NodeJS 14 on Alpine Linux

image-6

While working on Docker Playground, I wanted to try out installing NodeJS 14 over Alpine Linux OS. If you try to install it using apk tool, it will install NodeJS 12.

Installing NodeJS 14 is a bit tricky as the below steps won't work for you.

wget https://nodejs.org/dist/v14.4.0/node-v14.4.0-linux-x64.tar.xz

tar -xvf node-v14.4.0-linux-x64.tar.xz And once I try to run it:

~/node-v14.4.0-linux-x64/bin # ./node 
sh: ./node: not found
Enter fullscreen mode Exit fullscreen mode

Alpine uses musl instead of glibc, and the binaries distributed from node's website are built against glibc. Hence, the reason the official NodeJS binaries are not going to work.

How to fix this?

You need to download an unofficial build that is built against musl

wget https://unofficial-builds.nodejs.org/download/release/v14.4.0/node-v14.4.0-linux-x64-musl.tar.xz
Enter fullscreen mode Exit fullscreen mode
$ ./node
Welcome to Node.js v14.4.0.
Type ".help" for more information.
> 
Enter fullscreen mode Exit fullscreen mode

Have queries? Reach out to me over Twitter

Top comments (0)