Install NodeJS 6 in CentOS8


  • administrators

    By the time of this writing, the latest NodeJS is V14.3.0, so there is no meaning to install Node6, which is no longer supported.

    But I still wanted to give it a try, by following those commands:

    # Install Node.js 6.x repository
    curl -sL https://deb.nodesource.com/setup_6.x | bash -
    
    # Install Node.js and npm
    apt-get install -y nodejs
    

    Unfortunately, I got not just warnings, but it's failed to installed.
    Then I gave up, and tried to install the higher version of NodeJS by following this tutorial:
    https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-centos-8

    But I stuck at this command:

    sudo dnf module list nodejs
    
    

    It throw the errors:

    Failed to download metadata for repo 'nodesource'
    

    Believe it or not, it's not easy to find out the solution from Google. Finally, I figured it out at: https://www.cyberciti.biz/faq/centos-redhat-fedora-linux-remote-yum-repo-configuration/

    But in my case, I need to remove the repo, I installed when I tried to install NodeJS6, which are:

    cd /etc/yum.repos.d/
    sudo rm nodesource-el8.repo
    
    cd /etc/pki/rpm-gpg/
    sudo rm NODESOURCE-GPG-SIGNING-KEY-EL
    
    sudo yum clean all
    

    Happy Installing! 🙂