0

Have installed node 0.12.2, but need to revert to 0.10.33 to run the applications I need to. I have tried installing 0.10.33 and switching versions using

set 0.10.33 to default with 'nvm alias default 0.10.33'

But node runs previous version (0.12.2) when started again.

I have tried uninstalling node via various methods, but each one has been blocked:

uninstall node 

"You must be in root to run this tool"

(I am the only user (with Admin access) on my machine I tried

cd /

then

uninstall node

But still got "You must be in root to run this tool"

Tried

sudo uninstall node

"Uninstall Failed... Reason: ErrorMissingBundle"

I may have installed node with Homebrew - it was a while back, can't quite remember. So tried:

brew uninstall node 

"Error: No such keg: /usr/local/Cellar/node"

Other information I can give:

which node

/usr/local/bin/node

I see node and npm in /usr/local/bin

Any help most appreciated - I'm not a command line expert, and fairly new at Node.

mattw
  • 1
  • 1
  • 2

2 Answers2

2

To switch from different node.js version with nvm just use nvm use 0.10.33

Pierre Inglebert
  • 3,488
  • 1
  • 16
  • 22
  • OK, I have removed 0.12.2, and have 0.10.33 installed at the following location by nvm. /Users/matthewwilliams/.nvm/v0.10.33/bin/node However I still need to switch to 0.10.33 manually because when I start a bash and type "which node", no version is found. I understand i need to move node from my nvm directory in user directory to another location for default use, but I don't know the commands. What should I do here? Can someone please give me the commands to move this. Thanks. – mattw Jun 15 '15 at 12:47
  • nope, you have to run nvm use 0.10 everytime for your user, put it in your bash_profile. If you want to install it for all user, you must run `NVM_DIR=/usr/local/nvm curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.25.4/install.sh | bash` – Pierre Inglebert Jun 15 '15 at 13:13
1

It looks like you might be using NVM (node version manager). If you are you can install different versions using

nvm install version_no 

and then you can switch versions using the command

nvm use version_no    

If you have not used NVM to install node you can uninstall node using the instructions in this answer - How do I completely uninstall Node.js, and reinstall from beginning (Mac OS X).
Then if you need different versions of node I would recommend using NVM, which allows you to install and use different versions of node on the same system. https://github.com/creationix/nvm

Community
  • 1
  • 1
Craicerjack
  • 5,524
  • 2
  • 27
  • 36
  • Have tried most things here, I wonder if it might be something to do with paths. 0.10.33 is here: /Users/matthewwilliams/.nvm/v0.10.33/bin/node 0.12.2 is here: /usr/local/bin/node – mattw Jun 13 '15 at 17:50
  • I can switch versions, but it's not holding switched version as default This might also help explain problem: I hope a new bash, type node --version and get v0.12.2 I run . ~/.nvm/nvm.sh then nvm uninstall 0.12.2 it tells me version is not installed – mattw Jun 13 '15 at 18:02
  • Okay your path for each node should be the same. The looks like you have both node and nvm installed. If your using nvm you should only use `nvm install version` to install node and not other methods. I would use the link above to remove node and maybe even nvm and start again.... – Craicerjack Jun 13 '15 at 18:08
  • On another note what happens when you type `nvm use 0.10.33`? – Craicerjack Jun 13 '15 at 18:09
  • I will try the remove and reinstall. I think the problem was different Node versions installed via different ways. I can switch versions using nvm use 0.10.33 but when i stop and restart, 0.10.33 is lost. – mattw Jun 16 '15 at 14:49
  • @mattw what do you mean when you stop and start? If you mean your local machine, then yes, this is intentional. When you start you just type in `nvm use version` and it loads up the version of node you want, so you are only making changes in the node environment that you want. Its a bit like a python virtual environment, a bit. – Craicerjack Jun 16 '15 at 15:52