Search code examples
node.jscentos7

Can't install node js ver 18 on centOS 7.9


when i trying install node js ver 18 on centos it's show me this error

Error: Package: 2:nodejs-18.15.0-1nodesource.x86_64 (nodesource)
           Requires: libc.so.6(GLIBC_2.28)(64bit)
Error: Package: 2:nodejs-18.15.0-1nodesource.x86_64 (nodesource)
           Requires: libstdc++.so.6(GLIBCXX_3.4.20)(64bit)
Error: Package: 2:nodejs-18.15.0-1nodesource.x86_64 (nodesource)
           Requires: libm.so.6(GLIBC_2.27)(64bit)
Error: Package: 2:nodejs-18.15.0-1nodesource.x86_64 (nodesource)
           Requires: libstdc++.so.6(GLIBCXX_3.4.21)(64bit)
Error: Package: 2:nodejs-18.15.0-1nodesource.x86_64 (nodesource)
           Requires: libstdc++.so.6(CXXABI_1.3.9)(64bit)

i installed gcc but it still give me error


Solution

  • Ran into the same issue on CentOS 7.9. The solution was to install dnf and use that to install nodejs and yarn. Complete set of commands for nodejs + yarn:

    Add repos (https://github.com/nodesource/distributions#installation-instructions-1):

    curl -fsSL https://rpm.nodesource.com/setup_18.x | sudo bash -
    curl -sL https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo
    

    Install dnf

    sudo yum install dnf
    

    Install node and yarn:

    sudo dnf install nodejs
    sudo dnf install yarn