How can I install vuex in a vue CLI project? - vue.js

I install and create a project vue with VUE CLI.
I would like to add VUEX to add a store in my app.
But when I use:
npm install vuex --save-dev
I have errors:
Could not resolve dependency:peer vue#"^2.0.0" from vuex#3.6.2 node_modules/vuex vuex#"*" from the root project
How can I fix this?
Should I install vue in other way?

There are two ways to add vuex in Vue Cli Project
1 The following documentation can help you
npm install vuex
Another one is
vue add vuex

If you have problems with the command line, you can also add vuex with the User Interface. Just type vue ui and install vuex under plugins tab in the browser window, which just opened (at port 8000)

To install the latest version you can use:
npm install vuex#next --save

As stated in the documentation, the following command can help you:
yarn add vuex

Related

How to install vue.js version 2

I want to install version 2 of vue.js to use vuetify. However, I don't know the command for that. Could someone pass the command to me please
If you are looking for a specific version of Vue2 you can run the following command with npm: npm install vue#2.x.x or if you want the latest, simply npm install vue.
For vue3 it is: npm install vue#next
Сreated a new Vue.js project using Vue CLI. Select during installation Vue2
vue create my-app
# navigate to new project directory
cd my-app
Add vuetify
vue add vuetify
npm install vue#2.x.x --save
It will update package.json as well.
so later on, if you need to install the project from git, by running
npm install
easily package can be installed

Vue: not responding to commands

I installed vue using
npm install vue
But the terminal wasn't recognizing "vue" command (like vue --version), so I hitted:
npm install -g vue-cli#2.7.0
And now it says I have version 2.7.0 when I check the version, but it doens't respond neither shows any error when I try:
vue ui
It just doesn't run. Can anyone help?
That is no longer the name of the Vue CLI package. You will need to install from #vue/cli as detailed here: https://cli.vuejs.org/guide/installation.html

Vue - Plugins won't Install

I've tried to install the Vue Router and Vuex plugins, but the terminal simply stays like this indefinitely.
Vue is fully up to date and I'd tried reinstalling it, but to no avail.
I've also tried installing via the Vue UI but the same problem persists. Any idea what could be wrong? Thanks in advance.
Close Terminal and open again and try this steps.
npm install vue-router
npm install vuex

vue packages version mismatch vue#1.0.28-csp

I'm new to npm & vue and have followed instructions to install both.
When I run vue create, I get the follwing
Vue packages version mismatch:
- vue#1.0.28-csp (C:\Users....vue.common.js)
- vue-template-complier#2.6.10 (c:\Users.....package.json)
How do I fix this?
I've seen others with a similar problem but not with the -csp file
My Vue version is 3.11.0.
I've fixed the issue but I'm not sure how!
I uninstalled vue and then tried again:
npm install -g #vue/cli
vue init webpack vueapp01 - I didn't do this last time, so maybe this is the answer!
Now when I do vue create hello-world, it works!
Thanks for your help #Ohgodwhy
Your vue-cli version is 3.11.0, not your vue version. You have globally installed version of vue at 1.0.28-csp. What you should do is:
npm update -g vue
or
yarn global update vue
which should bring it in line with the template compiler.

How to upgrade from Vuetify 1.5 to 2.0

I'm trying to use the vuetify#2.0.0-alpha.17 rather than the 1.5.13 that it automatically starts with when I use vue add Vuetify. then I try this post Update Vuetify version method. I do
vue create my-app
cd my-app
vue add Vuetify
npm uninstall -S vuetify
npm install -S vuetify#2.0.0-alpha.17
and just get error
This dependency was not found:
* vuetify/src/stylus/app.styl in ./src/plugins/vuetify.js
To install it, you can run: npm install --save vuetify/src/stylus/app.styl
oh ok that's how install it. no that just gives an error too. Like I just want to start working with 2.0.0 so that when they release it- hopefully soon- I don't have to rebuild everything. Not sure why it's so hard like tell us in the docs how to do it not everybody is a wizard and googling the problem doesn't work
Comment out import 'vuetify/src/stylus/app.styl' in your src/plugins/vuetify.js file.
add import 'vuetify/src/styles/main.sass'
then npm install sass-loader
Vuetify v2 does not use the stylus. Remove import 'vuetify/src/stylus/app.styl' from src/plugins/vuetify.js. Or downgrade your vuetify plugin to 1.5.x (not recomended).