internal/modules/cjs/loader.js:905 npm error

My node works correctly but I have error when I run npm :

internal/modules/cjs/loader.js:905
  throw err;
  ^

Error: Cannot find module 'C:\Program Files\nodejs\node_modules\npm\bin\node_modules\npm\bin\npm-cli.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
    at Function.Module._load (internal/modules/cjs/loader.js:746:27)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
    at internal/main/run_main_module.js:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}
internal/modules/cjs/loader.js:905
  throw err;
  ^

Error: Cannot find module 'C:\Program Files\nodejs\node_modules\npm\bin\node_modules\npm\bin\npm-cli.js'
←[90m    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)←[39m
←[90m    at Function.Module._load (internal/modules/cjs/loader.js:746:27)←[39m
←[90m    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)←[39m
←[90m    at internal/main/run_main_module.js:17:47←[39m {
  code: ←[32m'MODULE_NOT_FOUND'←[39m,
  requireStack: []
}

At the third line there is a path, that path path is wrong.

The real path for npm-cli.js is : C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js

Besides I tried to find loader.js in cjs directory but didn't find it.

I tried to delete npm and npm-cache directories from Appdata/Roaming then unistall and reinstall node but I still have that problem (with npm only). How to resolve it ?



Read more here: https://stackoverflow.com/questions/68129967/internal-modules-cjs-loader-js905-npm-error

Content Attribution

This content was originally published by kalyklos at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: