import Vue from 'vue' imports “different” Vue to different files

谁说胖子不能爱 提交于 2019-12-05 07:26:19

I found the immediate cause. I first noticed that when loading the app, "You are running Vue in development mode." was printed twice in the console. They were both from vue.runtime.esm.js:7417, but served from different urls. (Webpack urls, since I was running npm run dev.) I noticed I had two node_modules directories (at ./ and ../../), and for some reason Vue was loaded once from both places. Probably I had installed the npm packages somehow in the wrong order. Removing both node_modules dirs and running npm install again solved the problem: now I can import Vue from 'vue' in mutations.js, and Vue.set(...) works as expected.

Anyway, I'm still not exactly aware of the actual npm problem or how to not do it again.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!