magenta placenta
magenta placenta

Reputation: 1525

Not seeing latest version when updating Node.js via installer (MSI) Windows 7

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?

Upvotes: 35

Views: 62561

Answers (13)

dtmiRRor
dtmiRRor

Reputation: 599

check your default version

node -v
v13.10.1

nvm ls
default -> v13.10.1

change the default to your version

nvm alias default 22.11.0

check version again:

node -v
v22.11.0

Upvotes: 0

Saad Abbasi
Saad Abbasi

Reputation: 853

You can fix this on Windows by following these steps if you have already installed nodejs latest version but that is not showing/working.

  1. Open Cmd type where node it will give you a path (like in the attachment)
  2. Go to that location and delete the node application exe file

and then come back and try to check that's all you are done , that was the issue of path, your system was using the old reference

Nodejs Screenshot

Upvotes: 0

Erwin Contreras
Erwin Contreras

Reputation: 1

Using where node, worked for me. That showed me that I had node in the heroku directory as well and since I won't be using that CLI anytime soon, I just removed that dir from the 'path' 'system variable'.

Upvotes: 0

Hondaman900
Hondaman900

Reputation: 139

I had the same problem in Windows 10 and none of the above recommendations worked. Then I closed the terminal window, restarted it and the correct version now showed, and the subsequent version errors running other commands also went away. Seems that the version loaded by Windows PowerShell is stuck until the terminal is relaunched. Clearing the cache via command line was futile.

Seems simple and dumb, but that resolved it for me (in the sense that it probably was resolved in the background but I couldn't see the resolution take effect until the terminal was reloaded). Hope this helps someone else.

Upvotes: 0

Iman Bahrampour
Iman Bahrampour

Reputation: 6800

To fix this problem you can modify your "Environment Variables".

  1. From "System Properties" open the "Environment Variables".
  2. In the system variables section select the path variable and click on the edit button.

enter image description here

  1. In this list you must have the latest folder of installed Node.js(delete other Node.js folders from the list).

Updated Node.js folder

That's it

Upvotes: 3

magicode118
magicode118

Reputation: 1474

Even though it might sound stupid, make sure you did not previously have node version managers installed which you no longer use, such as Nodist. These will allow the machine to only have their internal node version as the usable version and not the one you install yourself manually.

Uninstalling these package managers, if you want to manually update your Node/NPM versions, will solve the issue.

Upvotes: 1

Tore Aurstad
Tore Aurstad

Reputation: 3796

A tip that might be useful for others, I found it helpful to known for Windows platforms. Enter the command in cmd.exe:

where node

This outputted for me that node.exe was in a subdir of Chocolatey.

Problem was that this version was v8.11.1 and it did not work with newer version of the Angular-CLI. So I removed the exe and then ran the installer of the LTS version of Node on Nodejs website to get a working version of Node for Angular. Tested out on Windows 10.

So if you are on Windows, test out the where command in cmd.exe Linuxers and Mac-ers can use other commands, such as which command.

Screen shot below. I deleted the node.exe file before running the node.exe command.

Locating Node executable on the system in Windows

Upvotes: 5

WarStorm666
WarStorm666

Reputation: 1

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.

Upvotes: 0

Jeremy A. West
Jeremy A. West

Reputation: 2300

Windows Users

Node is most likely installed in 2 locations.

  1. C:\Program Files\nodejs
  2. 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:

  1. You do NOT need to uninstall
  2. 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?

Upvotes: 10

Sumit Ramteke
Sumit Ramteke

Reputation: 1496

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

  1. npm cache clean -f (force) clear you npm cache
  2. npm install -g n install "n" (this might take a while)
  3. n stable upgrade to lastest version

Upvotes: 11

eloone
eloone

Reputation: 4344

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.

Upvotes: 38

dcp
dcp

Reputation: 55424

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.

Upvotes: 5

Ranjitha Balaraman
Ranjitha Balaraman

Reputation: 19

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.

Upvotes: 1

Related Questions