Node.js 18 on Amazon Linux 2



I am having issues getting Node.js 18 to work on Amazon Linux 2. It seems like it installs fine but when I go to use it I am presented with the following error:

ec2-user@server1:/home/ec2-user/$> nvm use 18

node: /lib64/ version `GLIBC_2.27' not found (required by node)

node: /lib64/ 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.18.2 to unset it.

Not finding any clear path on getting GLIBC 2.27 or 2.28 on this OS.

ldd --version says that I am on 2.26.

Any assistance would be appreciated!

asked 9 months ago11576 views
2 Answers
Accepted Answer

Multiple AWS service teams have compiled binaries for NodeJS v18.x for Amazon Linux 2 to use in their services. These service teams include ElasticBeanstalk and Cloud9. You can find references to these binaries in the CloudWatch logs related to ElasticBeanstalk and Cloud9 resources.

While not officially supported by AWS, and only a specific version of NodeJS that has been compiled, you could borrow the NodeJS binary from the Cloud9 team and installon your Amazon Linux 2 based host.

### download the NodeJS binary (x86 only) 
wget -nv

mkdir /usr/local/lib/node
tar -xf node-v18.17.1.tar.gz
mv node-v18.17.1 /usr/local/lib/node/nodejs
### Unload NVM, use the new node in the path, then install some items globally.
echo "export NVM_DIR=''" >> /home/ec2-user/.bashrc
echo "export NODEJS_HOME=/usr/local/lib/node/nodejs" >> /home/ec2-user/.bashrc
echo "export PATH=\$NODEJS_HOME/bin:\$PATH" >> /home/ec2-user/.bashrc
### Reload environment
. /home/ec2-user/.bashrc
### Verify NodeJS v18.x is operating
node -e "console.log('Running Node.js ' + process.version)"
profile pictureAWS
answered 9 months ago
profile picture
reviewed 9 months ago
  • Wow, thank you - that worked flawlessly!

  • Do you have the corresponding ARM version of the link ?



Unfortunately Amazon Linux2 does not support Nodejs18.
If you want to use it on Amazon Linux2, you need to use Docker containers etc.
I think you can use Amazon Linux 2023 as described in the document below.

profile picture
answered 9 months ago
profile picture
reviewed 9 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions