user1272597
user1272597

Reputation: 1325

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

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.

Upvotes: 4

Views: 6797

Answers (2)

RHL
RHL

Reputation: 536

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

Upvotes: 0

TomManning
TomManning

Reputation: 101

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/

Upvotes: 8

Related Questions