关于Mac系统下wepy运行环境和vue运行环境冲突Error: Vue packages version mismatch:问题的解决方法
侧边栏壁纸
  • 累计撰写 635 篇文章
  • 累计收到 0 条评论

关于Mac系统下wepy运行环境和vue运行环境冲突Error: Vue packages version mismatch:问题的解决方法

加速器之家
2024-08-22 / 0 评论 / 3 阅读 / 正在检测是否收录...

安装好wepy环境好了之后,运行wepy热更新打包wepy build --watch,出现下面错误信息:

/usr/local/lib/node_modules/@wepy/cli/node_modules/vue-template-compiler/index.js:10

throw new Error(

^

Error:

Vue packages version mismatch:

- vue@3.3.4 (/usr/local/lib/node_modules/vue/index.js)

- vue-template-compiler@2.7.14 (/usr/local/lib/node_modules/@wepy/cli/node_modules/vue-template-compiler/package.json)

This may cause things to work incorrectly. Make sure to use the same version for both.

If you are using vue-loader@>=10.0, simply update vue-template-compiler.

If you are using vue-loader@<10.0 or vueify, re-installing vue-loader/vueify should bump vue-template-compiler to the latest.

at Object.<anonymous> (/usr/local/lib/node_modules/@wepy/cli/node_modules/vue-template-compiler/index.js:10:9)

当从字面上翻译,是vue和vue-template-compiler版本不一致,导致的,实际上是环境问题。接下来,我们就来处理这个问题。

1、首先先把关于vue的文件夹都移除或者删除,想恢复的可以备份

这里博主把位于/usr/local/lib/node_modules目录下的@vue和vue文件夹都删除放进回收站里面,以及/usr/local/bin目录下的vue快捷指令都删除。

2、接下来重新安装vue脚手架环境,安装指定版本,@vue/cli 4.5.13

sudo npm install -g @vue/cli@4.5.13

这样成功解决环境冲突问题。

0

评论

博主关闭了当前页面的评论