Node.js升级仍然在Windows中显示旧版本 [英] Node.js upgrade still shows older version in windows

查看:583
本文介绍了Node.js升级仍然在Windows中显示旧版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用.msi安装程序下载并安装了新版本的nodejs(4.1.2).之后,我运行了node -v,但是它仍然显示旧版本(0.12.2).我尝试重新启动Windows,甚至卸载并重新安装了nodejs,但仍然显示相同的内容.为什么会发生这种情况,我该如何解决?

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?

推荐答案

在通常的安装路径中搜索node.exe的多个副本:

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

  • 程序文件(x86)

  • 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
    

  • 升级npm有其自身的问题:

    Upgrading npm has its own issues:

    可能是您之前尝试升级npm,但由于某种原因失败了,然后又去寻找该工具.如果工具升级失败,则可能会因npm install npmnpm upgrade npm期间所做的部分更改而感到困扰.在这种情况下,您将必须完全卸载Node:

    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:

    卸载Node.js(选择卸载",而不是修复"选项).

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

    进入%programfiles%\nodejs并删除整个文件夹.

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

    删除%appdata%\npm%appdata%\npm-cache.

    编辑您的PATH并删除所有引用npm的内容(为此,请点击开始"并搜索环境变量").

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

    重新安装Node,然后安装此工具-仅使用此工具用于升级npm,请勿尝试运行npm install npm.

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

    参考

    文件系统的Get-ChildItem

    Microsoft NodeJS指南

    环境.SpecialFolder枚举(系统)

    公用文件夹变量-Windows Defender安全情报

    KNOWNFOLDERID (Windows)

    这篇关于Node.js升级仍然在Windows中显示旧版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆