0

When I run C:\Users%username%>npm -v on command prompt in windows 10 I get the error message below,

node:internal/modules/cjs/loader:959
  throw err;
  ^

Error: Cannot find module 'C:\Users\%username%\node_modules\npm\bin\npm-cli.js'
←[90m    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:956:15)←[39m
←[90m    at Function.Module._load (node:internal/modules/cjs/loader:804:27)←[39m
←[90m    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)←[39m
←[90m    at node:internal/main/run_main_module:17:47←[39m {
  code: ←[32m'MODULE_NOT_FOUND'←[39m,
  requireStack: []
}
iamdeed
  • 354
  • 4
  • 19

1 Answers1

1

The issue was due to the wrong path of node in system variable.

changing it from to C:\Program Files\nodejs\node_modules\npm\bin to C:\Program Files\nodejs resolved the issue

for non-admin users to set the path at system level start command prompt with run as administrator and use the below command

setx /M path "%path%;C:\Program Files\nodejs"

at the user level use the below

set PATH=%PATH%;C:\Program Files\nodejs

iamdeed
  • 354
  • 4
  • 19