Error npm-cli js not found when running npm

0 votes

Usually I can install a library using npm but today when installing yeoman I encountered this errors. Please help to figure out what's root cause.

D:\Works\niroj\ionic\todo>npm install -g yo
    module.js:340
    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 (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:906:3

I looked into the folder:

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

but don't see node_modules folder as the error described.

I also try to find npm-cli.js and see it's actually in C:\Program Files\nodejs\node_modules\npm\bin\

Sep 7, 2020 in Node-js by kartik
• 37,520 points
21,769 views

1 answer to this question.

+1 vote

Hello @kartik,

You need to run this in the command line.

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

Hope it helps!!

Thank You!

answered Sep 7, 2020 by Niroj
• 82,800 points
you save me.
Thank for the info..It worked
i was about to get depressed by fix attempts restarts reinstallations you just saved me