Retrofitting Node v20.12.2 (and NPM v10.5.0) in Ubuntu 18.04.3 LTS

One of the hardest part of system administration is to keep the systems updated and to keep it secure. But at times when it is not possible but needs a application support, then there is no other way than to tinker things and make it work and to retrofit the dependencies or to patch or to use custom things so that it does not break the other applications or the OS itself

Here we will be seeing how to install node v20.X.X and npm v10.X.X on Ubuntu 18.04.3 LTS

To ease up things and to have less headache we will be using NVM (Node Version Manager) to make it easier to install node and npm.

NVM takes care of the required npm verison for a specific node version and vice versa which will make our life easier.

Next we can focus on retrofitting node and npm on ubunt 18.04.3 LTS

Things Needed

  • Root
  • Node
  • Npm
  • Some build tools like make, gcc, bison etc
sudo apt-get install g++ make gcc bison patchelf
wget -c https://ftp.gnu.org/gnu/glibc/glibc-2.28.tar.gz
tar -zxf glibc-2.28.tar.gz
cd glibc-2.28
mkdir glibc-build && cd glibc-build
../configure --prefix=/opt/glibc-2.28
make && make install
patchelf --set-interpreter /opt/glibc-2.28/lib/ld-linux-x86-64.so.2 --set-rpath /opt/glibc-2.28/lib/:/lib/x86_64-linux-gnu/:/usr/lib/x86_64-linux-gnu/ /root/.nvm/versions/node/v20.12.2/bin/node

This will fix the following issue

node: /lib/x86_64-linux-gnu/libc.so.6: version 'GLIBC_2.28' not found (required by node)