Vue报错:This dependency was not found: vuex in ./node_modules/babel-loader/lib

报错

This dependency was not found:
* /components/Lianxi.vue in ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./src/App.vue
To install it, you can run: npm install --save /components/Lianxi.vue

在这里插入图片描述

原因&解决

1. 可能存在问题是 安装的vuex出现问题

解决方法:
根据提示再次安装 vuex,执行

npm install --save vuex

再不行那就是vuex的版本问题,vuex4不匹配vue2

详细查看下面博文:https://blog.csdn.net/weixin_45525272/article/details/124961685

2. 文件路径引入出现错误:

检查提示的路径,看看路径是否有问题
在这里插入图片描述

3. 代码写错了,例如:引入时候vuex后多打了一个空格

在这里插入图片描述

删除后就可以正确运行

猜你喜欢

转载自blog.csdn.net/weixin_45525272/article/details/124961383