解决 windows安装依赖或运行项目 报错

137 阅读1分钟

起因

今天从gitte上拉了一下,路佬刚完成的一个基于Vue2全栈教务系统项目-模拟实现支付服务的一个项目,想着来学习一下,然后..对,没错刚开始装完依赖就遇到一个关于node版本的问题,顺便记录一下。

1.报错信息

error eslint-plugin-vue@8.5.0: The engine "node" is incompatible with this module. Expected version "^12.22.0 ||error eslint-plugin-vue@8.5.0: The engine "node" is incompatible with this module. Expected version "^12.22.0 || ^14.17.0 || >=16.0.0". Got "12.19.0"

error Found incompatible module.

2.报错分析

node版本对应不上,项目要求的是 version “^12.22.0 || ^14.17.0 || >=16.0
.0”
 ,而我电脑安装的版本是12.19.0。

报错截图

image.png

3.解决办法

那当然是安装相对应的版本啦,但是我懒不可能去重新官网去装一遍node的,太麻烦。搜到一篇文章有介绍到 nvmw

4.安装 nvmw

  • 全局安装 nvmw
npm install -g nvmw
  • 使用nvmw
nvmw -h 帮助

nvmw -V 版本
  • 输入命令 nvmw -h,会显示一下信息
PS C:\Users\mint\Desktop\vue_xm_jwxt> nvmw -h
Usage: nvmw [options] [command]

Options:
  -V, --version        output the version number
  -h, --help           display help for command

Commands:
  install <version>    install the given version of Node
  uninstall <version>  uninstall the given version of Node
  use <version>        use the given version of Node in current shell
  deactivate           undo effects of nvmw in current shell
  switch <version>     permanently use the given version of Node as default
  switch-deactivate    permanently undo effects of nvmw
  ls                   list the installed all Nodes
  ls-remote            list remote versions available for install
  cleanup              remove stale local caches
  help [command]       display help for command


  Examples:

    nvmw install v0.10.20
    nvmw uninstall v0.10.20
    nvmw use v0.10.20

nvmw install v12.22.0 安装12.12.0版本的node,安装成功后提示

运行 nvmw use v12.22.0 切换到当前版本,至此成功升级node并切换到对应的版本。