Node.js 18 on Amazon Linux 2

0

Hello,

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/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.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!

Josh
demandé il y a 7 mois9008 vues
2 réponses
2
Réponse acceptée

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 https://d3rnber7ry90et.cloudfront.net/linux-x86_64/node-v18.17.1.tar.gz

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
répondu il y a 7 mois
profile picture
EXPERT
vérifié il y a 7 mois
  • Wow, thank you - that worked flawlessly!

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

0

Hello.

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.
https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/setting-up-node-on-ec2-instance.html
https://repost.aws/questions/QUrXOioL46RcCnFGyELJWKLw/glibc-2-27-on-amazon-linux-2

profile picture
EXPERT
répondu il y a 7 mois
profile picture
EXPERT
vérifié il y a 7 mois

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions