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달 전8901회 조회
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달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠