Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Node.js upgrade still shows older version in windows

I have downloaded and installed the new version of nodejs (4.1.2) using the .msi installer. After that I ran node -v, but it still shows the older version (0.12.2). I tried restarting Windows and even uninstalled nodejs and reinstalled it, but still it shows the same. Why is that happening and how can I resolve it?

like image 568
Nafis Avatar asked Oct 08 '15 11:10

Nafis


People also ask

How do I update my Node JS version?

1. Update Node Using Node Version Manager. Node Version Manager, or nvm, is far and away the best method to updating Node. You’ll need a C++ compiler, as well as the build-essential and libssl-dev packages. Run an update first, then get the packages:

How to install previous versions of node and NPM on Windows?

Installing the previous version of Node.js and NPM: To install the previous versions from the latest version, the latest version of Node.js should be installed on your computer or you can install it from the official site of Node.js. Step 1: Check the installed version of Node and NPM on the computer use the following command respectively

How to check the version of node on your system?

If you have Node on your system, you have NPM, as well. With the npm command, you can check running Node.js versions and install the latest release. By adding the n module, you can interactively manage Node.js versions. 1. First, clear the npm cache: 2. Install n, Node’s version manager: 3. With the n module installed, you can use it to:

Why does Node JS go back to old version after closing terminal?

After close terminal, it again went back to the older version of node js. – Deep Kakkar Jul 25 '19 at 11:11 Yes that's because you need to set v0.12.6as the default in nvm – eloone Jun 30 '20 at 21:43 2


1 Answers

Run a search for multiple copies of node.exe in the usual install paths:

  • Program Files

      Get-ChildItem -File -path $env:PROGRAMFILES -include node.exe -recurse -force
    
  • Program Files(x86)

      Get-ChildItem -File -path $env:PROGRAMFILESX86 -include node.exe -recurse -force
    
  • Common Files

      Get-ChildItem -File -path $env:COMMONPROGRAMFILES -include node.exe -recurse -force
    
  • Roaming

      Get-ChildItem -File -path $env:APPDATA -include node.exe -recurse -force
    

Upgrading npm has its own issues:

Chances are that you attempted to upgrade npm before, it somehow failed, and you then went looking for this tool. If the tool fails to upgrade, it may be troubled by partial changes done during npm install npm or npm upgrade npm. In that case, you will have to completely uninstall Node:

Uninstall Node.js (select Uninstall, not the Repair option).

Go into %programfiles%\nodejs and delete the entire folder.

Delete %appdata%\npm and %appdata%\npm-cache.

Edit your PATH and remove everything that references npm (to do so, hit "Start" and search for "Environment Variables").

Reinstall Node, then install this tool - and only use this tool to upgrade npm, do not attempt to run npm install npm.

References

  • npmjs docs: Prefix Configuration

  • Get-ChildItem for FileSystem

  • Finding files in the PATH with PowerShell

  • Microsoft NodeJS Guidelines

  • Environment.SpecialFolder Enumeration (System)

  • Common folder variables - Windows Defender Security Intelligence

  • KNOWNFOLDERID (Windows)

like image 110
Paul Sweatte Avatar answered Oct 17 '22 08:10

Paul Sweatte