Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: Cannot find module '@npmcli/config'

Tags:

node.js

npm

Any time I try and run any "npm" command, I get the error below around not being able to find the config for npmcli.

    Error: Cannot find module '@npmcli/config'
    Require stack:
    - C:\Users\User\AppData\Roaming\npm\node_modules\npm\lib\npm.js
    - C:\Users\User\AppData\Roaming\npm\node_modules\npm\lib\cli-entry.js
    - C:\Users\User\AppData\Roaming\npm\node_modules\npm\lib\cli.js
    - C:\Users\User\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1077:15)
    at Module._load (node:internal/modules/cjs/loader:922:27)
    at Module.require (node:internal/modules/cjs/loader:1143:19)
    at require (node:internal/modules/cjs/helpers:121:18)
    at Object.<anonymous> (C:\Users\olive\AppData\Roaming\npm\node_modules\npm\lib\npm.js:2:16)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Module._load (node:internal/modules/cjs/loader:960:12)
    at Module.require (node:internal/modules/cjs/loader:1143:19) {
    code: 'MODULE_NOT_FOUND',
    requireStack: [
    'C:\\Users\\User\\AppData\\Roaming\\npm\\node_modules\\npm\\lib\\npm.js',
    'C:\\Users\\User\\AppData\\Roaming\\npm\\node_modules\\npm\\lib\\cli-entry.js',
    'C:\\Users\\User\\AppData\\Roaming\\npm\\node_modules\\npm\\lib\\cli.js',
    'C:\\Users\\User\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js'
  ]
}

So far, I've tried:

  • Uninstalling, Deleting all node packages and reinstalling them.
  • Installing NVM (I have a Windows 10 machine)
  • Playing around with the Path value.
like image 367
DataNerd96 Avatar asked Sep 12 '25 04:09

DataNerd96


1 Answers

Download the latest version of NVM.

On windows, for me this was here: https://github.com/coreybutler/nvm-windows/releases

The latest version at the time of writing was 1.1.11

Exact steps were:

  • Install [email protected] via the nvm-update.exe download, on the link above
  • nvm uninstall 18.17 (or which ever version was failing)
  • nvm install 18.17
like image 194
DoubleA Avatar answered Sep 14 '25 18:09

DoubleA