0
votes

I'm new to all these and now learning Vue. I have install Vuex, use export default, and import it but still getting this error =>

** WARNING Compiled with 1 warnings
warning in ./src/store/index.js "export 'createStore' was not found in 'vuex'**

The index.js store file

import Vue from 'vue';
import Vuex from 'vuex';
Vue.use(Vuex);

import coachesModule from './modules/coaches/index.js';

const store = new Vuex.Store({
  modules: {
    coaches: coachesModule
  }
});

export default store;


The package.json file

{
  "name": "vue-first-app",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build",
    "lint": "vue-cli-service lint"
  },
  "dependencies": {
    "core-js": "^3.6.5",
    "vue": "^3.0.0",
    "vue-router": "^4.0.0-rc.5",
    "vuex": "^3.5.1"
  },
  "devDependencies": {
    "@vue/cli-plugin-babel": "~4.5.0",
    "@vue/cli-plugin-eslint": "~4.5.0",
    "@vue/cli-service": "~4.5.0",
    "@vue/compiler-sfc": "^3.0.0-0",
    "babel-eslint": "^10.1.0",
    "eslint": "^6.7.2",
    "eslint-plugin-vue": "^7.0.0-0"
  }
}


After uninstalling Vue using

npm uninstall -g @vue/cli

and reinstall Vue Using

npm install -g @vue/cli@latest 

npm i vue vue-router -S
npm install 

now still im getting :

 INFO  Starting development server...
98% after emitting CopyPlugin

 WARNING  Compiled with 1 warnings                                             3:56:20 PM

 warning  in ./src/store/index.js

"export 'default' (imported as 'Vue') was not found in 'vue'

Anyone can help me?

2
which documentation/tutorial are you following? and how did you install it?Boussadjra Brahim
could you share your package.json content and the link to the doc that you're reading?Boussadjra Brahim
ok for the docs, please share your store and package contentBoussadjra Brahim
please update your question with those detailsBoussadjra Brahim
do yo want work with vue 3 or 2? or you're new in vue world?Boussadjra Brahim

2 Answers

2
votes

Upd. You use vue3 and vuex3, but you should use vuex4.


Can you try to use

const store = new Vuex.Store({

instead of

const store = createStore({

?

According to this docs https://vuex.vuejs.org/guide/#the-simplest-store .

0
votes

createStore is Vuex 4 syntax, since you're using vuex 3 you should do :

import Vue from 'vue';
import Vuex from 'vuex';
Vue.use(Vuex)

import coachesModule from './modules/coaches/index.js';

const store = new Vuex.Store({
  modules: {
    coaches: coachesModule
  }
});

export default store;