在 Vue 3.0 应用程序中安装 vue-apollo 时版本不匹配

Version mismatch when installing vue-apollo in Vue 3.0 application

我使用

设置了一个新的 Vue 3.0 应用程序
vue create

然后我使用

将 apollo 添加到我的应用程序
vue add apollo

然后当我 运行 npm run build 我得到以下错误

ERROR  Failed to compile with 2 errors                                                                                                    

Module Error (from ./node_modules/vue-loader/lib/index.js):


Vue packages version mismatch:

- vue@3.0.0 (C:\workspace\StatusTool\dummy-project\node_modules\vue\index.js)
- vue-template-compiler@2.6.12 (C:\workspace\StatusTool\dummy-project\node_modules\vue-template-compiler\package.json)

This may cause things to work incorrectly. Make sure to use the same version for both.
If you are using vue-loader@>=10.0, simply update vue-template-compiler.
If you are using vue-loader@<10.0 or vueify, re-installing vue-loader/vueify should bump vue-template-compiler to the latest.


Module build failed (from ./node_modules/vue-loader/lib/index.js):
TypeError: Cannot read property 'parseComponent' of undefined
    at parse (C:\workspace\StatusTool\dummy-project\node_modules\@vue\component-compiler-utils\dist\parse.js:15:23)
    at Object.module.exports (C:\workspace\StatusTool\dummy-project\node_modules\vue-loader\lib\index.js:67:22)

我做错了什么?

版本信息:

好像没有安装 vue-apollo 包

不要使用 vue/cli: 4.5.6 而是需要使用 Manual install

vue add apollo 仅适用于 vue-cli 3 个项目。

安装简单。

npm install --save vue-apollo graphql apollo-boost

yarn add vue-apollo graphql apollo-boost

您仍然可以使用 apollo-boost