Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: Cannot find module '../lib/cli.js'

Tags:

npm

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.

like image 795
user1272597 Avatar asked Oct 17 '25 13:10

user1272597


1 Answers

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/

like image 168
TomManning Avatar answered Oct 20 '25 23:10

TomManning



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!