简体   繁体   English

在 PowerShell 上运行 npm 询问“你想如何打开这个文件?”,命令行很好

[英]Running npm on PowerShell asks "How do you want to open this file?", command line is fine

Whenever I run the npm command on Microsoft Windows PowerShell, it opens the Windows 10 popup asking What do you want to do with this file?... what do I want to open it with?每当我在 Microsoft Windows PowerShell 上运行 npm 命令时,它都会打开 Windows 10 弹出窗口,询问您想对这个文件做什么?...我想用什么打开它?

这是一个屏幕截图

But I can run node -v and it works fine.但我可以运行 node -v 并且它工作正常。 This means that I cannot do an "& npm install" from PowerShell to make it run cmd and that command.这意味着我无法从 PowerShell 执行“& npm install”以使其运行 cmd 和该命令。

Any ideas?有任何想法吗? I've looked around and no success...我环顾四周,没有成功...

In powershell run the command "get-command npm"在 powershell 中运行命令“get-command npm”

It may give you the wrong path.它可能会给你错误的路径。

I was getting the same error and the command told me it was finding npm in C:\WINDOWS\system32\npm我遇到了同样的错误,命令告诉我它在 C:\WINDOWS\system32\npm 中找到 npm

which was a 0 byte file.这是一个 0 字节的文件。 I deleted it and powershell now found the right path for npm.我删除了它,powershell 现在找到了 npm 的正确路径。

删除0字节文件路径:C:\WINDOWS\system32\npm 右键npm删除。

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

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