user000001 user000001 - 3 months ago 11
Node.js Question

Node.js version goes back to 0.4 form 0.6 on reboot (NVM)

I used nvm (node version manager) to upgrade node form v0.4 to v0.6.9
I used the following commands:

node -v -> v0.4.x
cd ~
git clone git://github.com/creationix/nvm.git ~/.nvm
. ~/.nvm/nvm.sh
nvm install v0.6.9
//wait a while
node -v -> v0.6.9


The problem is that each time I reboot my mac, node -v prints out v0.4. So I have to redo the procedure. I also have to run
rm -rf .nvm
before git clone. Can you please tell me why that happens and how can I fix it? Thanks.

Answer

The info I think you're missing is that nvm lets you manage multiple versions simultaneously. It does this by playing magic with your environment and paths.

After a reboot, I suspect you need only run these lines:

. ~/.nvm/nvm.sh
nvm use v0.6.9

That should cause you to re-enter the "magic" nvm environment which you previously installed v0.6.9 in.