nvm
command is a shell function declared in ~/.nvm/nvm.sh
.
You may source either of following scripts at the start of yours to make nvm()
available:
. ~/.nvm/nvm.sh
. ~/.profile
. ~/.bashrc
. $(brew --prefix nvm)/nvm.sh # if installed via Brew
I just checked the link you got this from. You are installing, specifically, version 0.10
, or trying to at least, but you have a newer version in the repo that's being installed. You have to follow the setup for node v5.
curl --silent --location https://rpm.nodesource.com/setup_5.x | bash -
PS: for future reference, make sure you read the sites very carefully especially when running commands as root.
EDIT:
Alright, it seems that you added the repo correctly. Looking into the repo, your packages are there but the system is looking for the wrong version. At this point, I would suggest.
yum clean all && yum update
That will clean cached repo and grab from remote.
Answer:
After the work we've done over the chat
, here's the correct answer for you. nodejs v5
installed fine. You previously compiled nodejs v0.12
manually, which is not a good idea on binary distros, because you will end up in this position.
which node
returned
/usr/local/bin/node
while
/usr/bin/node
returned the correct answer of v5.x
.
At this point you have multiple options to fix it, but I would recommend 2.
- 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 simple as adding alias node="/usr/bin/node"
. This will call the correct version every time 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
the nodejs that is installed on the system. Second, get the tarball for the version you have compiled, untar it, ./configure
and uninstall it. This step, you can find online easily. Finally, reinstall nodejs
through yum
, and that should fix your problem.
Best Answer