NPM install doesn't find a module because it uses the wrong path

Answered

Hi, 

So when I run npm install on Intellij IDEA here is what comes on the console.

If I understand correctly, it seems that instead of looking at the path given in parameter, it looks for a path that has been altered (\node_modules\npm\bin as been added). I have no clue of what I did wrong and can't seem to find any similar problem online.

Thank you for taking time reading me.

"C:\Program Files\nodejs\node_modules\npm\bin\npm.cmd" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" install --scripts-prepend-node-path=auto
node:internal/modules/cjs/loader:936
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 (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
0
3 comments

Please share a screnshot of Settings | Languages & Frameworks | Node.js page - looks as if you have specified

C:\Program Files\nodejs\node_modules\npm\bin\npm.cmd

as Node interpreter there. But npm.cmd is not a Node.js interpreter, please try choosing a valid interpreter there (C:\Program Files\nodejs\node.exe)

1

Facing the same issue. Anyone knows how to resolve?

0

Please sign in to leave a comment.