Wednesday, February 21, 2024
HomeSoftware Engineering Error: Can not discover module ‘../lib/cli.js’

[Solved] Error: Can not discover module ‘../lib/cli.js’


If you happen to attempt to run npm i and get Error: Can not discover module '../lib/cli.js', then you possibly can simply repair the issue by operating the next.

How does the error look?

Error: Can not discover module '../lib/cli.js'
Require stack:
- /usr/native/lib/node_modules/npm/bin/npm-cli.js
    at Perform.Module._resolveFilename (node:inside/modules/cjs/loader:933:15)
    at Perform.Module._load (node:inside/modules/cjs/loader:778:27)
    at Module.require (node:inside/modules/cjs/loader:999:19)
    at require (node:inside/modules/cjs/helpers:102:18)
    at Object.<nameless> (/usr/native/lib/node_modules/npm/bin/npm-cli.js:2:1)
    at Module._compile (node:inside/modules/cjs/loader:1095:14)
    at Object.Module._extensions..js (node:inside/modules/cjs/loader:1147:10)
    at Module.load (node:inside/modules/cjs/loader:975:32)
    at Perform.Module._load (node:inside/modules/cjs/loader:822:12)
    at Perform.executeUserEntryPoint [as runMain] (node:inside/modules/run_main:81:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/usr/local/lib/node_modules/npm/bin/npm-cli.js' ]
}

How you can remedy the Module Not Discovered error

brew uninstall --ignore-dependencies node
sudo chown -R $(whoami) /usr/native/*
brew cleanup
brew set up node

This can uninstall and cleanup your earlier node set up, ensuring to set the right permissions, earlier than reinstalling it.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments