Error: Cannot find module '@npmcli/config' nvm切换出错

115 阅读1分钟

Error: Cannot find module '@npmcli/config'

关于 Error: Cannot find module '@npmcli/config' Require stack: - C:\nvmNew\nvm\v20.17.0\node_modules\npm\lib\npm.js - C:\nvmNew\nvm\v20.17.0\node_modules\npm\lib\cli\entry.js - C:\nvmNew\nvm\v20.17.0\node_modules\npm\lib\cli.js - C:\nvmNew\nvm\v20.17.0\node_modules\npm\bin\npm-cli.js at Module._resolveFilename (node:internal/modules/cjs/loader:1225:15) at Module._load (node:internal/modules/cjs/loader:1051:27) at Module.require (node:internal/modules/cjs/loader:1311:19) at require (node:internal/modules/helpers:179:18) at Object.<anonymous> (C:\nvmNew\nvm\v20.17.0\node_modules\npm\lib\npm.js:2:16) at Module._compile (node:internal/modules/cjs/loader:1469:14) at Module._extensions..js (node:internal/modules/cjs/loader:1548:10) at Module.load (node:internal/modules/cjs/loader:1288:32) at Module._load (node:internal/modules/cjs/loader:1104:12) at Module.require (node:internal/modules/cjs/loader:1311:19) { code: 'MODULE_NOT_FOUND', requireStack: [ 'C:\\nvmNew\\nvm\\v20.17.0\\node_modules\\npm\\lib\\npm.js', 'C:\\nvmNew\\nvm\\v20.17.0\\node_modules\\npm\\lib\\cli\\entry.js', 'C:\\nvmNew\\nvm\\v20.17.0\\node_modules\\npm\\lib\\cli.js', 'C:\\nvmNew\\nvm\\v20.17.0\\node_modules\\npm\\bin\\npm-cli.js' ] }

解决问题一、去node官网下载压缩包解压放在nvm目录下面,名字记得改(不改我也没用过)例如v2x.xx.0 解决问题二、换nvm版本 例:1.1.17可以用node14.xx.x但是用不了20.xx.xx,换更高版本的1.2.2就可以 嗯...................就这么解决