本文介绍: 【代码】NPM安装报错:ERROR: npm v10.2.1 is known not to run on Node.js v10.24.1.

问题描述

NPM卸载版本安装版本运行报错:

C:UsersAdministrator>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:UsersAdministratorAppDataRoamingnpmnode_modulesnpmlibutilsexit-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:UsersAdministratorAppDataRoamingnpmnode_modulesnpmlibcli-entry.js:15:23)
    at module.exports (C:UsersAdministratorAppDataRoamingnpmnode_modulesnpmlibes6validate-engines.js:39:10)
    at module.exports (C:UsersAdministratorAppDataRoamingnpmnode_modulesnpmlibcli.js:4:31)

解决方案

删除目录C:UsersAdministratorAppDataRoaming下的npmnpm-cache目录重新安装

原文地址:https://blog.csdn.net/libra_boy/article/details/133960115

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。

如若转载,请注明出处:http://www.7code.cn/show_11449.html

如若内容造成侵权/违法违规/事实不符,请联系代码007邮箱suwngjj01@126.com进行投诉反馈,一经查实,立即删除

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注