Currently I tried installing Node Js specific version 4.8 on my Centos-7 64 bit machine. Using below commands
# curl -sL https://rpm.nodesource.com/setup_4.x | bash -
# yum install -y nodejs
But when I check the Node version it show 6.11.1
I want to install Node Js for Meteor 1.5.0 and specifically Node 4.8.
I also ran command cat /etc/yum.repos.d/nodesource-el.repo
to cross-check, I got below reponse
[nodesource]
name=Node.js Packages for Enterprise Linux 7 - $basearch
baseurl=https://rpm.nodesource.com/pub_4.x/el/7/$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/NODESOURCE-GPG-SIGNING-KEY-EL
[nodesource-source]
name=Node.js for Enterprise Linux 7 - $basearch - Source
baseurl=https://rpm.nodesource.com/pub_4.x/el/7/SRPMS
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/NODESOURCE-GPG-SIGNING-KEY-EL
gpgcheck=1
I also ran command rpm -qa 'node|npm'
I got nodesource-release-el7-1.noarch
I also ran below commands and tried reinstalling my specific version but no success.
yum remove nodesource-release* nodejs
yum clean all
Any Suggestion if I am doing anything wrong?
It's difficult to give you a answer because the problem could has more than one reasons, maybe in this link you can find more help because the problem is treated in depth.
Also I'm going to explain my solution was made months ago, I remove all the node repos:
After that, clean and update:
And after that, try again to install node 4.
If you have the same error at this point, it's because you have 2 paths of nodejs, probably if you run
$ which node
it returns/usr/local/bin/node
instead of/usr/bin/node
Then, you have two options as in the first answer in the previous link i gave says:
Option 1:
This is the easy way out. You can edit your .bashrc and add an alias that will point node -> /usr/bin/node. This is as simpple as adding alias node="/usr/bin/node". This will call the correct version everytime but I cannot guarantee that it will not cause conflicts in the future with libraries.
Option 2: This is the hard way but it will fix it. First, purge with yum nodejs installed on the system. Second, get the tarball for the version you have compile, untar it, ./configure and uninstall it. This step, you can find online easily. Finally, reinstall nodejs through yum and that should fix your problem.
Well, to install your specific node version you need to run below command sequentially:
Next, we will extract the binary package into our system's local package hierarchy with the tar command. The archive is packaged within a versioned directory, which we can get rid of by passing the
--strip-components 1
option. We will specify the target directory of our command with the-C
command:This will install all of the components within the
/usr/local
branch of your system. You can verify that the installation was successful by asking Node for its version number: