问题描述1:
warning in ./node_modules/vuex/dist/vuex.esm-browser.js 1077:9-14 "export ‘watch’ was not found in ‘vue’
warning in ./node_modules/vuex/dist/vuex.esm-browser.js 140:17-25 "export ‘reactive’ was not found in ‘vue’
warning in ./node_modules/vuex/dist/vuex.esm-browser.js 14:9-15 "export ‘inject’ was not found in ‘vue’
warning in ./node_modules/vuex/dist/vuex.esm-browser.js 345:2-7 "export ‘watch’ was not found in ‘vue’
解决方案:
因为用的是vue cli2 脚手架2来创建的项目:vue init webpack xxxx --0ffline
所以导致的是版本不适应,vuex默认安装的版本过高,所以:
- 先卸载vuex
npm uninstall vuex
- 再重新安装vuex
cnpm i vuex@3
- 再重新启动项目即可
npm run dev
问题描述2:
export ‘inject’ (imported as ‘inject’) was not found in ‘vue’ (possible exports: default)
export ‘reactive’ (imported as ‘reactive’) was not found in ‘vue’ (possible exports: default)
export ‘watch’ (imported as ‘watch’) was not found in ‘vue’ (possible exports: default)
解决方案:(版本不兼容问题)
- 先卸载vuex
npm uninstall vuex
- 重新安装低版本vuex
npm i vuex@3.4.0
- 重新运行项目即可
npm run serve