問題描述
NPM卸載高版本后安裝低版本運行報錯:文章來源:http://www.zghlxwxcb.cn/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
目錄后重新安裝。文章來源地址http://www.zghlxwxcb.cn/news/detail-771055.html
到了這里,關于NPM安裝后報錯:ERROR: npm v10.2.1 is known not to run on Node.js v10.24.1.的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關文章,希望大家以后多多支持TOY模板網(wǎng)!