How to add Vuex 3 for Vue 2.7?
P粉222320176
P粉222320176 2024-04-05 13:49:24
0
1
1552

When I run: yarn create nuxt-app I see in package.json:

"dependencies": {
   "nuxt": "^2.15.8",
   "vue": "^2.7.10",
},

I need to use Vuex. For this environment I have to use Vuex 3. So I did what the documentation said: yarn add vuex. But this always results in installing vuex 4:

"dependencies": {
   "nuxt": "^2.15.8",
   "vue": "^2.7.10",
   "vuex": "^4.1.0"
},

But this will cause various problems, because vuex 4 only works with Vue 3.

The result of running yarn add vuex is the same as running yarn add vuex@next --save.

How do I install Vuex 3 for Vue 2.7 in my Nuxt project? What did I miss?

P粉222320176
P粉222320176

reply all(1)
P粉674999420

yarn add package-name Installs the "latest" version of the package. yarn add package-name@1.2.3 Installed a specific version of a package from the registry.

Try yarn add vuex@3

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template