Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install node in Amazon Linux 2

I purchased Amazon Linux 2 machine using AWS LightSail and tried to install node on that machine. But after several tries I can't able to install node and got the error shared below.

[root@ip-my public ip /]# sudo yum install nodejs
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
Resolving Dependencies
--> Running transaction check
---> Package nodejs.x86_64 2:18.3.0-1nodesource will be installed
--> Processing Dependency: libc.so.6(GLIBC_2.28)(64bit) for package: 2:nodejs-18.3.0-1nodesource.x86_64
--> Processing Dependency: libm.so.6(GLIBC_2.27)(64bit) for package: 2:nodejs-18.3.0-1nodesource.x86_64
--> Finished Dependency Resolution
Error: Package: 2:nodejs-18.3.0-1nodesource.x86_64 (nodesource)
           Requires: libc.so.6(GLIBC_2.28)(64bit)
Error: Package: 2:nodejs-18.3.0-1nodesource.x86_64 (nodesource)
           Requires: libm.so.6(GLIBC_2.27)(64bit)
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

Thanks in advance!

like image 960
Sarvath S Avatar asked Aug 23 '26 22:08

Sarvath S


2 Answers

I think AWS LightSail Amazon Linux 2 supports node version <=16.x, So we want to install node version <=16, I installed node version 16 and it works!!

Here are the steps followed,

Step 1:- Configure Yum Repository

$ sudo yum install -y gcc-c++ make 
$ curl -sL https://rpm.nodesource.com/setup_16.x | sudo -E bash -

Step 2:– Install Node.js on Amazon Linux

$ sudo yum install -y nodejs 

Step 3 – Check Version

$ node -v  
$ npm -v
    
like image 128
Sarvath S Avatar answered Aug 26 '26 12:08

Sarvath S


My solution to fix this problem, you must erase cache with this command:

sudo rm -R /var/cache/yum/x86_64/2/nodesource/

Now, you can download the correct version:

curl -sL https://rpm.nodesource.com/setup_16.x | sudo -E bash -

And now you can install:

sudo yum install -y nodejs
like image 29
Leonel Pech Avatar answered Aug 26 '26 12:08

Leonel Pech



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!