执行 npm 相关指令出现如下报错:
ERROR: npm v10.3.0 is known not to run on Node.js v12.18.2. 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/.
报错信息表示:
当前node版本过低,与npm过高当前版本无法协作,需要重新配置当前环境;
如果我们当前项目需要的node版本没限制的话,我们可以直接升级node版本 (安装包下载地址:https://nodejs.org/en)
npm彻底卸载方式:
手动删除npm缓存和安装文件,目录:C:\Users\用户目录\AppData\Roaming,删除该目录下npm/和npm-cache/两个文件夹。
卸载node
再重新安装即可;