简体   繁体   English

不清楚使用的是哪个版本的 vue.js

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

I installed npm install -g @vue/cli我安装了npm install -g @vue/cli

After installation, I create a project vue create hello-world安装后,我创建一个项目vue create hello-world

After creating the project, I run the following command: npm list vue Returns `-- vue@3.2.20.创建项目后,我运行以下命令: npm list vue返回`-- vue@3.2.20。 This indicates that the project is using vue.js version 3.2.20这表明该项目使用的是 vue.js 版本 3.2.20

But if you look in package.json, then the version of "vue" will be indicated there: "vue": "^3.0.0",但是如果你查看package.json,那么“vue”的版本会在那里显示: “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.如果我去vue ui,那里也会显示3.2.20版本。 But the package.json of the project shows version 3.0.0.但是项目的 package.json 显示的是 3.0.0 版本。 How to fix it?如何解决? Explain what's going on?解释发生了什么?

在此处输入图片说明

在此处输入图片说明

在此处输入图片说明

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). package.json 中的插入符号 (^) 表示 Vue 将更新到所有未来的次要版本,而不会超过主要版本(在您的情况下为版本 3)。

The version you got through npm list vue , 3.2.20 matches this rule 3.XX你通过npm list vue , 3.2.20 得到的版本符合这个规则 3.XX

For more info on carets(^) and tildes (~), check the following question: Difference between tilde and caret .有关插入符号(^) 和波浪号 (~) 的更多信息,请检查以下问题: 波浪号和插入符之间的区别

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM