首页 前端知识 NPM安装后报错:ERROR: npm v10.2.1 is known not to run on Node.js v10.24.1.

NPM安装后报错:ERROR: npm v10.2.1 is known not to run on Node.js v10.24.1.

2024-05-24 08:05:32 前端知识 前端哥 91 203 我要收藏

问题描述

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)

解决方案

删除目录C:\Users\Administrator\AppData\Roaming下的npmnpm-cache目录后重新安装。

转载请注明出处或者链接地址:https://www.qianduange.cn//article/9345.html
标签
评论
发布的文章

用JS生成本周日期代码

2024-04-18 17:04:15

js 递归函数

2024-05-31 10:05:46

jQuery是什么?如何使用?

2024-03-12 01:03:24

js延迟加载的六种方式

2024-05-30 10:05:51

大家推荐的文章
会员中心 联系我 留言建议 回顶部
复制成功!