问题描述
NPM卸载高版本后安装低版本运行报错:文章来源:https://www.toymoban.com/news/detail-771055.html
C:\Users\Administrator>npm -v
ERROR: npm v10.2.1 is known not to run on Node.js v10.24.1. This version of npm supports the following node versions: `^18.17.0 || >=20.5.0`. You can find the latest version at https://nodejs.org/.
ERROR:
C:\Users\Administrator\AppData\Roaming\npm\node_modules\npm\lib\utils\exit-handler.js:19
const hasLoadedNpm = npm?.config.loaded
^
SyntaxError: Unexpected token .
at Module._compile (internal/modules/cjs/loader.js:723:23)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at module.exports (C:\Users\Administrator\AppData\Roaming\npm\node_modules\npm\lib\cli-entry.js:15:23)
at module.exports (C:\Users\Administrator\AppData\Roaming\npm\node_modules\npm\lib\es6\validate-engines.js:39:10)
at module.exports (C:\Users\Administrator\AppData\Roaming\npm\node_modules\npm\lib\cli.js:4:31)
解决方案
删除目录C:\Users\Administrator\AppData\Roaming
下的npm
和npm-cache
目录后重新安装。文章来源地址https://www.toymoban.com/news/detail-771055.html
到了这里,关于NPM安装后报错:ERROR: npm v10.2.1 is known not to run on Node.js v10.24.1.的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!