Search code examples
node.jspowershellnpmregistrycommand-prompt

Unable to run npm commands


Im using a windows 11 machine, and whenever i execute npm install or npm --version or any npm command it gives me errors like this

The syntax of the command is incorrect. The syntax of the command is incorrect. The syntax of the command is incorrect. /F was unexpected at this time.

I am attaching the snapshot of the terminal as well here. Screenshot

I thought maybe something is wrong with my command prompt but when I run other commands like java --version or git --version they execute properly.

What could be the issue? is it something to do with my windows registy? Please help


Solution

  • I found the solution. So I am putting it up here for others. The problem was the windows registry. After changing the value of EnableExtensions to 1 in regedit -> HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor, it started working.