I encountered the following error while executing any npm command, such as 'npm -v', on a Windows system.
\AppData\Roaming\nvm\v20.11.1\node_modules\npm\lib\es6\validate-engines.js:31
throw err
^
Error: Cannot find module '@npmcli/config'
Require stack:
- \AppData\Roaming\nvm\v20.11.1\node_modules\npm\lib\npm.js
- \AppData\Roaming\nvm\v20.11.1\node_modules\npm\lib\cli-entry.js
- \AppData\Roaming\nvm\v20.11.1\node_modules\npm\lib\cli.js
- AppData\Roaming\nvm\v20.11.1\node_modules\npm\bin\npm-cli.js
at Module._resolveFilename (node:internal/modules/cjs/loader:1144:15)
at Module._load (node:internal/modules/cjs/loader:985:27)
at Module.require (node:internal/modules/cjs/loader:1235:19)
at require (node:internal/modules/helpers:176:18)
at Object.<anonymous> (\AppData\Roaming\nvm\v20.11.1\node_modules\npm\lib\npm.js:2:16)
at Module._compile (node:internal/modules/cjs/loader:1376:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
at Module.load (node:internal/modules/cjs/loader:1207:32)
at Module._load (node:internal/modules/cjs/loader:1023:12)
at Module.require (node:internal/modules/cjs/loader:1235:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'\\AppData\\Roaming\\nvm\\v20.11.1\\node_modules\\npm\\lib\\npm.js',
'\AppData\\Roaming\\nvm\\v20.11.1\\node_modules\\npm\\lib\\cli-entry.js',
'\\albin\\AppData\\Roaming\\nvm\\v20.11.1\\node_modules\\npm\\lib\\cli.js',
'\\albin\\AppData\\Roaming\\nvm\\v20.11.1\\node_modules\\npm\\bin\\npm-cli.js'
]
}
I was managing Node.js using NVM, and the issue only occurred with versions 20.11.0 and above, while earlier versions worked perfectly. The PATH setup appeared to be correct. Ultimately, I resolved the issue by directly downloading and installing Node.js on the system.
No comments:
Post a Comment