When you trying to install Nodejs on Amazon Linux machine and when execute below command
nvm install node
You may encounter below error:
v18.0.0 is already installed. node: /lib64/libm.so.6: version `GLIBC_2.27' not found (required by node) node: /lib64/libc.so.6: version `GLIBC_2.28' not found (required by node) nvm is not compatible with the npm config "prefix" option: currently set to "" Run `nvm use --delete-prefix v18.0.0` to unset it. [ec2-user@ip-xx-xxx-xx-xx ~]$ node -e "console.log('Running Node.js ' + process.version)" -bash: node: command not found
Now, you want to know why this error occurred. The above error occurred because you using latest version not Active LTS Version.
For Detail Explanation:
Major Node.js versions enter Current release status for six months, which gives library authors time to add support for them. After six months, odd-numbered releases (9, 11, etc.) become unsupported, and even-numbered releases (10, 12, etc.) move to Active LTS status and are ready for general use. LTS release status is “long-term support”, which typically guarantees that critical bugs will be fixed for a total of 30 months. Production applications should only use Active LTS or Maintenance LTS releases.
How to Fix “`GLIBC_2.27′ not found (required by node) While Installing Node on Amazon EC2 instance” ?
To fix this error, you have to install and use Active LTS Version not latest version.
during writing of this article, Active LTS version is 16. So, install version 16.
nvm install 16
Active LTS Version will change in future. Check Active LTS Version here: https://nodejs.org/en/about/releases/
I am hoping this will fix your error.