简体   繁体   English

警告未为 npm 安装卸载

[英]warn uninstall not installed for npm

I downloaded and installed nodejs on Windows.我在 Windows 上下载并安装了 nodejs。 I'm trying to uninstall the version of typescript I have to get to an older version.我正在尝试卸载我必须使用旧版本的打字稿版本。 When I run当我跑

npm uninstall typescript 

or或者

npm uninstall -g typescript

I get我明白了

npm warn uninstall not installed in C:\Program Files\nodejs\node_modules: "typescript@0.9.7"

How can I uninstall typescript without having npm uninstall work?如何在没有 npm 卸载工作的情况下卸载 typescript? Thanks in advance.提前致谢。

You should have been able to uninstall typescript with the command您应该能够使用以下命令卸载 typescript

npm rm typescript
npm rm -g typescript

which is equivalent to uninstall .这相当于uninstall If that doesn't work, it is safe to find the typescript directory in Windows Explorer under C:\Program Files\nodejs\node_modules and remove it.如果这不起作用,可以安全地在 Windows 资源管理器中的C:\Program Files\nodejs\node_modules下找到typescript目录并将其删除。

This should get you to a state with no typescript installed:这应该让您进入没有安装打字稿的状态:

npm ls typescript
npm ls -g typescript

both show (empty) .都显示(empty)

Second point: npm view typescript version is not showing you information about your local setup, but rather the state of the npm repository, so it will always show you the version that corresponds to typescript@latest .第二点: npm view typescript version不会显示有关本地设置的信息,而是显示npm存储库的状态,因此它始终会显示与typescript@latest对应的版本。 At the time you asked this question, it was 0.9.7;当你问这个问题时,它是 0.9.7; it is now 1.3.0现在是 1.3.0

Finally: to install a specific version of typescript such as 0.9.5, do最后:要安装特定版本的打字稿,例如 0.9.5,请执行

npm install -g typescript@0.9.5

Also, in general, you should make sure you have the latest node and npm .此外,一般来说,您应该确保您拥有最新的nodenpm Updating npm on windows is a little tricky;在 windows 上更新npm有点棘手; you should follow the guide here: https://github.com/npm/npm/wiki/Troubleshooting#upgrading-on-windows你应该按照这里的指南: https ://github.com/npm/npm/wiki/Troubleshooting#upgrading-on-windows

I recommend you to reinstall npm as this shouldn't happen.我建议您重新安装 npm,因为这不应该发生。 When the issue is still going on, open the directory and manually remove the files from that package.当问题仍然存在时,打开目录并手动从该包中删除文件。

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

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