如何解决 Intellij 中的“程序 'npm.cmd' 运行失败:访问被拒绝在 line:1 char:1”错误?

zoe*_*zoe 0 intellij-idea access-denied node.js npm visual-studio-code

我在 Windows 10 上安装了“node”和“npm”。我使用以下命令检查安装情况,一切正常。

c:\>node -v
v16.17.0

c:\>npm -v
8.15.0 
Run Code Online (Sandbox Code Playgroud)

当我尝试在“IntelliJ”终端中运行以下命令时,出现错误。

PS D:\Cypress> npm init
Program 'npm.cmd' failed to run: Access is deniedAt line:1 char:1
+ npm init 
+ ~~~~~~~~.
At line:1 char:1
+ npm init
+ ~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (:) [], ApplicationFailedException
    + FullyQualifiedErrorId : NativeCommandFailed
Run Code Online (Sandbox Code Playgroud)

我该如何解决?

zoe*_*zoe 5

Command Prompt感谢@lena,我在两者中创建了新的终端类型,IntelliJ并且VSCode它们都工作了。看来防火墙被阻止了powrshell,因此将终端类型从 更改为powershell有效Command Prompt