Home > OS >  How to solve "Program 'npm.cmd' failed to run: Access is deniedAt line:1 char:1"
How to solve "Program 'npm.cmd' failed to run: Access is deniedAt line:1 char:1"

Time:09-26

I installed "node" and "npm" on Windows 10. I check the installation using following commands and it's all fine.

c:\>node -v
v16.17.0

c:\>npm -v
8.15.0 

When I try to run the following command in the "IntelliJ" terminal I get an error.

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

How can I solve it?

CodePudding user response:

Thanks to @lena I created new terminals of type "Command Prompt" in both "IntelliJ" and "VSCode" and they both worked. It seems that firewall was blocking powrshell so changing the terminal type from "powershell" to "Command Prompt" worked.

  • Related