1

Whenever I try to run any npm related command such as npm -v or npm install , it gives me the error:

enter image description here

From the screenshot, you can see that it is trying to navigate to find the module but the module can not be found at:

C:\Program Files\nodejs\node_modules\npm\bin\node_modules\npm\bin\npm-cli.js

Actually, the location of the npm-cli in my system is:

C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js

In fact, I have set the path in the environment variable like this:

User variables:

enter image description here

System variables:

enter image description here

The solution I got is to run this command every time I want to run any npm related command:

SET PATH=C:\Program Files\Nodejs;%PATH%

But it is not a solution to run this command in the terminal every time I start working on my project in VS Code. I want to permanently set the path in the environment variable.

How can I resolve this?

halfer
  • 18,701
  • 13
  • 79
  • 158
Ibad Shaikh
  • 192
  • 2
  • 11

0 Answers0