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
已提问 7 个月前9006 查看次数
2 回答
2
已接受的回答

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
已回答 7 个月前
profile picture
专家
已审核 7 个月前
  • 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
专家
已回答 7 个月前
profile picture
专家
已审核 7 个月前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则