I'm trying to update node on my Windows 7 box but I'm not seeing the latest version after I re-install/update node.
I'm just going out to http://nodejs.org/download/ and getting the latest Windows installer, v0.10.28. I then just run that installer where it defaults to installing everything on my local hard drive, including npm, which is cool because I wanted to upgrade that as well.
Install runs/finishes with no apparent problem, but when I do a:
node --version
I'm still seeing my "old" version, v0.10.15, not the latest I supposedly just installed, v0.10.28. My npm version still reports my "old" version as well.
I've tried rebooting as well.
How the heck does one update node/npm?
I had a similar problem but on MacOS and the reason was I had nvm
installed. So running the commands found on most websites:
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
didn't work, node -v
still displayed the old version.
What I did was to install node from nvm:
nvm install v0.12.6
This will build node from scratch on your machine, and then node -v
will display the correct version. I think I could have still used the previous commands by using n
and then do nvm use v0.12.6
, but this is something to test. If you have nvm
installed, just check the commands for nvm
to upgrade node.
Answer given by Johan Dettmar about using n will work here as well.
For Windows
: open command prompt as administrator
For Linux/Mac
: sudo -s
on terminal
npm cache clean -f
(force) clear you npm cache
npm install -g n
install "n" (this might take a while)
n stable
upgrade to lastest version
I had this exact same problem, and one thing to be careful about is to make sure you are downloading the correct architecture version (e.g. 32-bit or 64-bit). When upgrading, I had downloaded the 32-bit version and didn't realize it. But the previous version I had installed was 64-bit. So I actually ended up with a 32-bit and 64-bit version installed. But when you go to do an uninstall, it only lists one version of node.js, so even after I uninstalled, it uninstalled the latest version, but kept the earlier version on there. That's why I kept getting the old version when I did "node -v".
Once I downloaded the correct version (64 bit in my case), the problem was resolved.
Windows Users
Node is most likely installed in 2 locations.
- C:\Program Files\nodejs
- C:\Program Files (x86)\nodejs
Rename the folder of the (x86) version to "nodejsOLD", restart command prompt, and try again.
node -v
The installer works just fine, things you do NOT need to do:
- You do NOT need to uninstall
- You do NOT need to reboot
There is a good discussion for Windows and node on stack overflow here:
How do I update npm on Windows?
To update Node, download the latest http://nodejs.org/dist/latest/node.exe (or http://nodejs.org/dist/latest/x64/node.exe for 64bit systems) and replace your old node.exe with it.
To update npm, run the npm update npm -g command.
I had the same problem - but it was caused due too duplicated versions of nodejs being set in my environmental variables.
You can easily check that in Windows using where node
in cmd. If more than one path is being output that might be the reason for this error. You can fix it by removing the other environmental variables.