简体   繁体   English

Node.js 升级仍然在 Windows 中显示旧版本

[英]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.我已经使用 .msi 安装程序下载并安装了新版本的 nodejs (4.1.2)。 After that I ran node -v , but it still shows the older version (0.12.2).之后我运行了node -v ,但它仍然显示旧版本(0.12.2)。 I tried restarting Windows and even uninstalled nodejs and reinstalled it, but still it shows the same.我尝试重新启动 Windows,甚至卸载 nodejs 并重新安装它,但它仍然显示相同。 Why is that happening and how can I resolve it?为什么会发生这种情况,我该如何解决?

Run a search for multiple copies of node.exe in the usual install paths:在通常的安装路径中搜索 node.exe 的多个副本:

  • Program Files程序文件

     Get-ChildItem -File -path $env:PROGRAMFILES -include node.exe -recurse -force
  • Program Files(x86)程序文件(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:升级 npm 有其自身的问题:

Chances are that you attempted to upgrade npm before, it somehow failed, and you then went looking for this tool.有可能您之前尝试过升级 npm,但不知何故失败了,然后您就去寻找这个工具。 If the tool fails to upgrade, it may be troubled by partial changes done during npm install npm or npm upgrade npm .如果工具升级失败,它可能会受到npm install npmnpm upgrade npm期间所做的部分更改的困扰。 In that case, you will have to completely uninstall Node:在这种情况下,您必须完全卸载 Node:

Uninstall Node.js (select Uninstall, not the Repair option).卸载 Node.js(选择卸载,而不是修复选项)。

Go into %programfiles%\nodejs and delete the entire folder.进入%programfiles%\nodejs并删除整个文件夹。

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

Edit your PATH and remove everything that references npm (to do so, hit "Start" and search for "Environment Variables").编辑您的 PATH 并删除所有引用 npm 的内容(为此,点击“开始”并搜索“环境变量”)。

Reinstall Node, then install this tool - and only use this tool to upgrade npm, do not attempt to run npm install npm .重新安装 Node,然后安装此工具- 仅使用此工具升级 npm,不要尝试运行npm install npm

References参考

我有同样的问题,并通过删除程序文件(x64)中的 node.js 文件夹解决了它,它 w

I had remove Nsolid path from Environment.我已经从环境中删除了 Nsolid 路径。 it should be relate to node.exe in different path, make sure Nsolid, %appdata%/npm dont have node.exe file.它应该与不同路径中的 node.exe 相关,确保 Nsolid、%appdata%/npm 没有 node.exe 文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM