Home > Enterprise >  Error : cannot find module npmlog (required by npmcli)
Error : cannot find module npmlog (required by npmcli)

Time:12-22

I was trying to install some dependancies for jupyter with npm, so it works with javascript. I am currently having trouble, anything I do with npm throws this error :

node:internal/modules/cjs/loader:998
  throw err;
  ^

Error: Cannot find module 'npmlog'
Require stack:
- /usr/share/npm/bin/npm-cli.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:995:15)
    at Module._load (node:internal/modules/cjs/loader:841:27)
    at Module.require (node:internal/modules/cjs/loader:1061:19)
    at require (node:internal/modules/cjs/helpers:103:18)
    at /usr/share/npm/bin/npm-cli.js:22:13
    at Object.<anonymous> (/usr/share/npm/bin/npm-cli.js:153:3)
    at Module._compile (node:internal/modules/cjs/loader:1159:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
    at Module.load (node:internal/modules/cjs/loader:1037:32)
    at Module._load (node:internal/modules/cjs/loader:878:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/usr/share/npm/bin/npm-cli.js' ]
}

This same error pops whenever I try to use npm, for anything, even npm version throws it.

I have tried removing npm, nodejs and all their dependancies and installing it again with apt-get, I have also tried to do what was advised in this old issue. I tried using nvm. I tried deleting the usr/bin/node before reinstalling node. Even this command threw the same error :

npm install -g [email protected]

It might help to know I work on linux mint ? Nothing helped, this error is still there, I can't use npm and I don't understand what's going on... Does anyone has any idea on why that might happen ?

Thank you for your time and have a nice day.

CodePudding user response:

Try clear the npm cache by running npm cache clean --force. This can help resolve issues caused by corrupted cache data.

If you are using linux, make sure you have the correct permissions to install npm packages. You may need to run the command with sudo.

  • Related