vue.jsvue-clivue-cli-3vue-cli-4

It is not clear which version of vue.js is being used


I installed npm install -g @vue/cli

After installation, I create a project vue create hello-world

After creating the project, I run the following command: npm list vue Returns `-- vue@3.2.20. This indicates that the project is using vue.js version 3.2.20

But if you look in package.json, then the version of "vue" will be indicated there: "vue": "^3.0.0",

It confuses me. How to fix it?. It is not clear to me which version is being used in the project. If I go to vue ui, then version 3.2.20 will also be indicated there. But the package.json of the project shows version 3.0.0. How to fix it? Explain what's going on?

enter image description here

enter image description here

enter image description here


Solution

  • The caret (^) in your package.json indicates that Vue will be updated to all future minor versions without exceeding the major version (version 3 in your case).

    The version you got through npm list vue, 3.2.20 matches this rule 3.X.X

    For more info on carets(^) and tildes (~), check the following question: Difference between tilde and caret.