如何完全卸载所有版本的 TypeScript
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26596061/
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 uninstall all versions TypeScript
提问by Mike Cheel
I have tried:
我试过了:
npm uninstall typescript -g
choco uninstall typescript
as well as looking in Programs for the visual studio uninstaller (which wasn't there), as mentioned here: uninstalling typescript without node
以及查看 Visual Studio 卸载程序的程序(不存在),如下所述:卸载没有节点的打字稿
I still have 2 directories (1.0 and 1.1) under Microsoft SDKs and I don't see any sort of uninstaller in there.
我在 Microsoft SDK 下仍然有 2 个目录(1.0 和 1.1),我在那里看不到任何类型的卸载程序。
I am wondering what is the cleanest way to remove all installations of TypeScript from my system?
我想知道从我的系统中删除所有 TypeScript 安装的最干净的方法是什么?
采纳答案by Ryan Cavanaugh
TypeScript is built into both VS 2013 Update 2 the VS 14 CTP and cannot be separately uninstalled. You could uninstall both of those versions of Visual Studio if it is somehow critical to remove those folders.
TypeScript 内置于 VS 2013 Update 2 和 VS 14 CTP 中,无法单独卸载。如果删除这些文件夹很重要,您可以卸载这两个版本的 Visual Studio。
回答by Dan Randolph
You can now uninstall "TypeScript Tools for Microsoft Visual Studio 2015" from the Control Panel in Programs and Features. It was automatically installed with Visual Studio 2015 in my case.
您现在可以从“程序和功能”中的“控制面板”卸载“Microsoft Visual Studio 2015 的 TypeScript 工具”。就我而言,它是随 Visual Studio 2015 自动安装的。
回答by CodeManX
You might have an old TypeScript installation on your computer because of a Microsoft SDK:
由于 Microsoft SDK,您的计算机上可能安装了旧的 TypeScript:
cmd>tsc --version
Version 1.0.3.0
If you check the PATH
environment variable, you may find an entry like this:
如果您检查PATH
环境变量,您可能会发现这样的条目:
C:\Program Files (x86)\Microsoft SDKs\TypeScript.0\
In my case, the uninstallation of "TypeScript Tools for Microsoft Visual Studio 2015" did not remove tsc.exe
etc. from this path, probably because it was installed as part of the Windows 10 SDK or something else.
在我的情况下,“Microsoft Visual Studio 2015 的 TypeScript 工具”的卸载并没有tsc.exe
从这个路径中删除等,可能是因为它是作为 Windows 10 SDK 或其他东西的一部分安装的。
You can remove the entry from the PATH
environment variable or at least move it below the entry for Node.js (probably C:\Program Files\nodejs
) or nvm (like C:\Users\<username>\AppData\Roaming\nvm
) in case you use Node Version Manager. This will prevent that calls to tsc
run the ancient TypeScript compiler:
如果您使用 Node Version Manager,您可以从PATH
环境变量中删除该条目,或者至少将其移动到 Node.js(可能C:\Program Files\nodejs
)或 nvm(如C:\Users\<username>\AppData\Roaming\nvm
)的条目下方。这将阻止调用tsc
运行古老的 TypeScript 编译器:
cmd>tsc --version
Version 3.1.3
Don't forget to restart your command line after changes to environment variables for them to take effect!
不要忘记在更改环境变量后重新启动命令行以使它们生效!
If you are unsure what binary the tsc
command will actually run then use the where
command to find out:
如果您不确定该tsc
命令将实际运行什么二进制文件,请使用该where
命令找出:
cmd>where tsc
C:\Program Files\nodejs\tsc
C:\Program Files\nodejs\tsc.cmd
C:\Program Files (x86)\Microsoft SDKs\TypeScript.0\tsc.exe
C:\Program Files (x86)\Microsoft SDKs\TypeScript.0\tsc.js
The priority is top to bottom. The first entry in my case is a (Linux) shell script and usually not executable on Windows. The second entry is a Windows Batch script and this is the one that will be executed. It basically invokes Node.js (simplified):
优先级是从上到下。在我的情况下,第一个条目是(Linux)shell 脚本,通常在 Windows 上不可执行。第二个条目是 Windows 批处理脚本,这是将要执行的脚本。它基本上调用 Node.js(简化):
node.exe node_modules\typescript\bin\tsc