NPM安装后报错:ERROR:npmv10.2.1isknownnottorunonNode.jsv10.24.1.
(2024-09-05 16:05:25)分类: htmlcssjsnodejs |
问题描述
NPM卸载高版本后安装低版本运行报错:
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)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
解决方案
删除目录C:\Users\Administrator\AppData\Roaming下的npm和npm-cache目录后重新安装。
————————————————
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
原文链接:https://blog.csdn.net/libra_boy/article/details/133960115
NPM卸载高版本后安装低版本运行报错:
C:\Users\Administrator>npm -v
ERROR: npm v10.2.1 is known not to run on Node.js v10.24.1.
ERROR:
C:\Users\Administrator\AppData\Roaming\npm\node_modules\npm\lib\utils\exit-handler.js:19
SyntaxError: Unexpected token .
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
解决方案
删除目录C:\Users\Administrator\AppData\Roaming下的npm和npm-cache目录后重新安装。
————————————————
原文链接:https://blog.csdn.net/libra_boy/article/details/133960115