如何从 Windows 中完全删除 node.js
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20711240/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to completely remove node.js from Windows
提问by Andrew De Forest
I uninstalled my previous version of node.js (0.8.11) and downloaded the latest, 0.10.24 from the node.js website and installed it. However, after running node --version, it still indicates that I'm running v0.8.11. Obviously, some stuff was left behind during the uninstall process, and it's causing me to have all sorts of errors when trying to add modules through npm. I've seen solutions to this for OSX and Linux, but couldn't find anything for Windows. I'm running Windows 7 64-bit.
我卸载了以前版本的 node.js (0.8.11) 并从 node.js 网站下载了最新的 0.10.24 并安装了它。但是,运行后node --version,它仍然表明我正在运行v0.8.11。显然,在卸载过程中留下了一些东西,这导致我在尝试通过 npm 添加模块时出现各种错误。我已经看到了针对 OSX 和 Linux 的解决方案,但找不到任何适用于 Windows 的解决方案。我正在运行 Windows 7 64 位。
回答by brandonscript
How to remove Node.js from Windows:
如何从 Windows 中删除 Node.js:
Take a deep breath.
Run
npm cache clean --forceUninstall from Programs & Features with the uninstaller.
Reboot (or you probably can get away with killing all node-related processes from Task Manager).
Look for these folders and remove them (and their contents) if any still exist. Depending on the version you installed, UAC settings, and CPU architecture, these may or may not exist:
C:\Program Files (x86)\NodejsC:\Program Files\NodejsC:\Users\{User}\AppData\Roaming\npm(or%appdata%\npm)C:\Users\{User}\AppData\Roaming\npm-cache(or%appdata%\npm-cache)C:\Users\{User}\.npmrc(and possibly check for that without the.prefix too)C:\Users\{User}\AppData\Local\Temp\npm-*
Check your
%PATH%environment variableto ensure no references toNodejsornpmexist.If it's stillnot uninstalled, type
where nodeat the command prompt and you'll see where it resides -- delete that (and probably the parent directory) too.Reboot, for good measure.
深吸一口气。
跑
npm cache clean --force使用卸载程序从程序和功能中卸载。
重新启动(或者您可能可以从任务管理器中杀死所有与节点相关的进程)。
查找这些文件夹并删除它们(及其内容)(如果仍然存在)。根据您安装的版本、UAC 设置和 CPU 架构,这些可能存在也可能不存在:
C:\Program Files (x86)\NodejsC:\Program Files\NodejsC:\Users\{User}\AppData\Roaming\npm(或%appdata%\npm)C:\Users\{User}\AppData\Roaming\npm-cache(或%appdata%\npm-cache)C:\Users\{User}\.npmrc(也可能在没有.前缀的情况下检查)C:\Users\{User}\AppData\Local\Temp\npm-*
检查您的
%PATH%环境变量以确保没有引用Nodejs或npm存在。如果它仍未卸载,请
where node在命令提示符下键入,您将看到它所在的位置——也删除它(可能还有父目录)。重新启动,很好的措施。
回答by Michael M
Scenario: Removing NodeJS when Windows has no Program Entry for your Node installation
场景:当 Windows 没有用于您的 Node 安装的程序条目时删除 NodeJS
I ran into a problem where my version of NodeJS (0.10.26) could NOTbe uninstalled nor removed, because Programs & Features in Windows 7 (aka Add/Remove Programs) had no record of my having installed NodeJS... so there was no option to remove it short of manually deleting registry keys and files.
我跑到哪里我的版本中的NodeJS(0.10.26)可能有问题不被卸载,也不能被删除,因为程序和功能在Windows 7(又名添加/删除程序)无我有安装的的NodeJS记录......所以有除了手动删除注册表项和文件之外,没有选项可以删除它。
Command to verify your NodeJS version:node --version
验证您的 NodeJS 版本的命令:node --version
I attempted to install the newest recommended version of NodeJS, but it failed at the end of the installation process and rolled back. Multiple versions of NodeJS also failed, and the installer likewise rolled them back as well. I could not upgrade NodeJS from the command line as I did not have SUDO installed.
我尝试安装 NodeJS 的最新推荐版本,但在安装过程结束时失败并回滚。NodeJS 的多个版本也失败了,安装程序同样也将它们回滚了。我无法从命令行升级 NodeJS,因为我没有安装 SUDO。
SOLUTION: After spending several hours troubleshooting the problem, including upgrading NPM, I decided to reinstall the EXACT version of NodeJS on my system, over the top of the existing installation.
解决方案:在花了几个小时解决问题后,包括升级 NPM,我决定在我的系统上重新安装 NodeJS 的 EXACT 版本,覆盖现有安装。
That solution worked, and it reinstalled NodeJS without any errors. Better yet, it also added an official entry in Add/Remove Programs dialogue.
该解决方案有效,并且它重新安装了 NodeJS,没有任何错误。更好的是,它还在添加/删除程序对话框中添加了一个官方条目。
Now that Windows was aware of the forgotten NodeJS installation, I was able to uninstall my existing version of NodeJS completely. I then successfully installed the newest recommended release of NodeJS for the Windows platform (version 4.4.5 as of this writing) without a roll-back initiating.
既然 Windows 已经意识到被遗忘的 NodeJS 安装,我就可以完全卸载我现有的 NodeJS 版本。然后,我成功地为 Windows 平台安装了 NodeJS 的最新推荐版本(撰写本文时为 4.4.5 版),而没有启动回滚。
It took me a while to reach sucess, so I am posting this in case it helps anyone else with a similar issue.
我花了一段时间才取得成功,所以我发布了这篇文章,以防它可以帮助其他有类似问题的人。
回答by Deepa
回答by user3049320
I actually had a failure in the Microsoft uninstall. I had installed node-v8.2.1-x64 and needed to run version node-v6.11.1-x64.
我实际上在 Microsoft 卸载中失败了。我已经安装了 node-v8.2.1-x64 并且需要运行 node-v6.11.1-x64 版本。
The uninstalled was failing with the error: "Windows cannot access the specified device, path, or file" or similar.
卸载失败并出现错误:“Windows 无法访问指定的设备、路径或文件”或类似错误。
I ended up going to the Downloads folder right clicking the node-v8.2.1-x64 MSI and selecting uninstall.. this worked.
我最终转到下载文件夹,右键单击 node-v8.2.1-x64 MSI 并选择卸载..这有效。
Regards, Jon
问候, 乔恩
回答by James Drinkard
In my case, the above alone didn't work. I had installed and uninstalled several versions of nodejs to fix this error: npm in windows Error: EISDIR, read at Error (native) that I kept getting on any npm command I tried to run, including getting the npm version with: npm -v.
就我而言,仅靠上述方法是行不通的。我已经安装并卸载了多个版本的 nodejs 来修复此错误:Windows 中的 npm 错误:EISDIR,读取错误(本机),我一直在尝试运行任何 npm 命令,包括使用以下命令获取 npm 版本: npm -v。
So the npm directory was deleted in the nodejs folder and the latest npm version was copied over from the npm dist: and then everything started working.
因此,在 nodejs 文件夹中删除了 npm 目录,并从npm dist复制了最新的 npm 版本:然后一切都开始工作了。
回答by Mikhail Orlov
I came here because the Remove button was not available from Add/Remove programs. It was saying "Node.js cannot be removed".
我来到这里是因为“添加/删除”程序中没有“删除”按钮。它说“无法删除 Node.js”。
This worked:
这有效:
- Got the .msi of my installed Node version. Ran it to repair the installation just in case.
- Opened the Administrator command prompt and ran
msiexec /uninstall <node.msi>.
- 得到了我安装的 Node 版本的 .msi。运行它以修复安装以防万一。
- 打开管理员命令提示符并运行
msiexec /uninstall <node.msi>。
回答by Ravi Bhadauria
I had the same problem with me yesterday and my solution is: 1. uninstall from controlpanel not from your cli 2. download and install the latest or desired version of node from its website 3. if by mistake you tried uninstalling through cli (it will not remove completely most often) then you do not get uninstall option in cpanel in this case install the same version of node and then follow my 1. step
我昨天遇到了同样的问题,我的解决方案是: 1. 从控制面板而不是从您的 cli 卸载 2. 从其网站下载并安装最新或所需版本的节点 3. 如果您错误地尝试通过 cli 卸载(它将大多数情况下不完全删除)那么在这种情况下,您不会在 cpanel 中获得卸载选项,请安装相同版本的节点,然后按照我的 1. 步骤操作
Hope it helps someone.
希望它可以帮助某人。
回答by ibnou abass Diagne
The best thing to do is to remove Node.js from the control panel. Once deleted download the desired version of Node.js and install it and it works.
最好的办法是从控制面板中删除 Node.js。一旦删除,下载所需版本的 Node.js 并安装它,它就可以工作了。


