Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm command : Cannot find module npm-cli.js [duplicate]

Since today I can't use any npm command.

Here's what I get everytime:

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

Error: Cannot find module 'C:\Users\Adrien\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
    at Function.Module._load (internal/modules/cjs/loader.js:508:25)
    at Function.Module.runMain (internal/modules/cjs/loader.js:754:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)

I use Windows 10. The commands for node work. I tried to uninstall Node.js, change the path in environment variables, but nothing changes...

Everything worked fine until I work on my new React.js project and got errors.

I have no npm folder in C:\Users\Adrien\AppData\Roaming\npm\node_modules

Thank you for your help.

like image 798
renadr Avatar asked Oct 26 '25 06:10

renadr


2 Answers

Simply just restart your PC, refresh code editor and run the command.

like image 151
Shubham Jain Avatar answered Oct 28 '25 20:10

Shubham Jain


Spent the past 24 hrs trying to resolve this and good now:

Go to settings - apps - node.js.

Here, two options prevail, 'modify' or 'unistall', select 'modify' and then press the 'repair' button which appears on the next dialogue window. Doing so will re-install a complete set of the files.

Go to PwerShell (Windows) or Bash (Mac) and type in 'npm -v', you should get a positive return, i.e., a display of the npm version number successfully installed.

I needed to resolve this as a pre-requisite to installing Truffle to support my Ethereum development environment.

like image 28
KIASILI.io Avatar answered Oct 28 '25 20:10

KIASILI.io



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!