4

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.

0

5 Answers 5

2

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

Sign up to request clarification or add additional context in comments.

1 Comment

This worked for me as well. It started probably after a Win10 update.
2

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.

1 Comment

Not entirely sure why I needed to repair it after installing the latest version but repairing worked. Thank you.
0

The issue is due to wrong path of node in system variable. Please make sure that points to the right directory.

1 Comment

I tried paths as : C:\Users\Adrien\AppData\Roaming\npm , C:\Program Files\nodejs\node_modules\npm and it's still not working. However NodeJS works.
0

A quick solution is npm install -D npm. Although this is not a great solution because you need to set your workspace correctly. But, it works and you can use it on urgent basis. ;)

Comments

0

if you struggle with the same probleme here how i personnaly solve it : Just open the configuration panel windows like if you want to uninstall node, but right clic and select repair

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.