4

i installed yarn/webpack and after that npm crashed! I get the following error:

npm -v
node:internal/modules/cjs/loader:928
throw err;
^

Error: Cannot find module '../lib/cli.js'
Require stack:
- /usr/local/lib/node_modules/npm/bin/npm-cli.js
  at Function.Module._resolveFilename (node:internal/modules/cjs/loader:925:15)
  at Function.Module._load (node:internal/modules/cjs/loader:769:27)
  at Module.require (node:internal/modules/cjs/loader:997:19)
  at require (node:internal/modules/cjs/helpers:92:18)
  at Object.<anonymous> (/usr/local/lib/node_modules/npm/bin/npm-cli.js:2:1)
  at Module._compile (node:internal/modules/cjs/loader:1108:14)
  at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
  at Module.load (node:internal/modules/cjs/loader:973:32)
  at Function.Module._load (node:internal/modules/cjs/loader:813:14)
  at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [ '/usr/local/lib/node_modules/npm/bin/npm-cli.js' ]
}

The error appears whatever I like to do with npm. I'm working on Mac OSX 10.14.6

Node Version: 15.4.0 Yarn Version: 1.22.10

thanks for help.

1
  • seems to be mac specific? can you set a tag? Commented Apr 14, 2021 at 18:42

2 Answers 2

8

This happened to me when I used brew install node. I fixed it by doing brew uninstall node (just to clean up) and then installing nodejs by downloading the package from https://nodejs.org/

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

1 Comment

same on my macbook - big sure. This fixed the error. As brew told me, I had to remove the folder with "sudo rm ..." manually. thx
0

Just uninstall using brew uninstall node, download and install package from https://nodejs.org.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.