Akryum / vue-cli-plugin-apollo

🚀 @vue/cli plugin for Vue Apollo
https://vue-cli-plugin-apollo.netlify.com/
479 stars 110 forks source link

Vue3 Installation error : `Error: You cannot call "get" on a collection with no paths.` #438

Open mathieutu opened 4 years ago

mathieutu commented 4 years ago

Hi @Akryum.

I got this error with @vue/cli 4.5.6 and vue 3.0.0 when trying to install.

Thanks.

λ › vue add apollo            

📦  Installing vue-cli-plugin-apollo...

yarn add v1.22.10
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
[4/4] 🔨  Building fresh packages...
success Saved 1 new dependency.
info Direct dependencies
└─ vue-cli-plugin-apollo@0.22.2
info All dependencies
└─ vue-cli-plugin-apollo@0.22.2
✨  Done in 7.93s.
✔  Successfully installed plugin: vue-cli-plugin-apollo

? Add example code Yes
? Add a GraphQL API Server? No
? Configure Apollo Engine? No

🚀  Invoking generator for vue-cli-plugin-apollo...
 ERROR  Error: You cannot call "get" on a collection with no paths. Instead, check the "length" property first to verify at least 1 path exists.
Error: You cannot call "get" on a collection with no paths. Instead, check the "length" property first to verify at least 1 path exists.
    at Collection.get (/Users/mathieutu/.config/yarn/global/node_modules/jscodeshift/src/Collection.js:213:13)
    at injectOptions (/Users/mathieutu/.config/yarn/global/node_modules/@vue/cli/lib/util/codemods/injectOptions.js:15:6)
    at runTransformation (/Users/mathieutu/.config/yarn/global/node_modules/vue-codemod/dist/src/run-transformation.js:61:17)
    at /Users/mathieutu/.config/yarn/global/node_modules/@vue/cli/lib/Generator.js:290:23
    at Array.forEach (<anonymous>)
    at Generator.resolveFiles (/Users/mathieutu/.config/yarn/global/node_modules/@vue/cli/lib/Generator.js:276:24)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async Generator.generate (/Users/mathieutu/.config/yarn/global/node_modules/@vue/cli/lib/Generator.js:175:5)
    at async runGenerator (/Users/mathieutu/.config/yarn/global/node_modules/@vue/cli/lib/invoke.js:111:3)
    at async invoke (/Users/mathieutu/.config/yarn/global/node_modules/@vue/cli/lib/invoke.js:92:3)
mathieutu commented 4 years ago

Actually I followed thi comment and it worked: https://github.com/vuetifyjs/vue-cli-plugins/issues/140#issuecomment-670971894

This is due to vue 3 incompatibility.

Add

new Vue({
    render: h => h(App),
}).$mount('#app');

in your main file and remove it afterwards.

EDIT: In fine it doesn't work anyway because the provided version and files are not compatible with vue-cli 3. 😞

andreasmalaer commented 3 years ago

In fine it doesn't work anyway because the provided version and files are not compatible with vue-cli 3. 😞

@mathieutu I ran into the same issue. However, @vue/apollo-composable works with Vue 3 after manual installation and the following repo shows how https://github.com/GraphQLGuide/guide-vue

twelve17 commented 2 years ago

Is vue-cli-plugin-apollo still not compatible with Vue 3?