vueuse / vue-demi

🎩 Creates Universal Library for Vue 2 & 3
MIT License
2.98k stars 155 forks source link

Pinia2.1.3 + vue3.3.4 does not work: hasInjectionContext is not defined #233

Closed qq958691165 closed 1 year ago

qq958691165 commented 1 year ago

pinia.mjs:6 Uncaught SyntaxError: The requested module '/node_modules/vue-demi/lib/index.mjs?v=151548d1' does not provide an export named 'hasInjectionContext' (at pinia.mjs:6:10)

lixin59 commented 1 year ago

I had the same problem image image image

sincely commented 1 year ago

pinia降版本至2.0.23,可以用

Teaghy commented 1 year ago

我有同样的问题 图像 图像 图像

This is because your vite-plugin-uni plugin is based on vue@3.2.47. hasInjectionContext is a method added in version 3.3, which Pinia is currently using and requires the latest 3.3 version. If you are using Vue 3.2, you cannot use the latest version of Pinia. image image

LuckyArdhika commented 1 year ago

I'm sure this happens to programmers all over the world

RSS1102 commented 1 year ago

yes, thanks.I also encountered this problem. pinia the new version should be with Vue@3.3 +.


@posva should this indicate a warning in Pinia's docs?

posva commented 1 year ago

This error means you dont have the necessary vue version installed. Pinia has the peer dependency set to ^3.3.0, it’s important to not ignore that warning when installing.

If a library like uview plus is adding vue as a dependency, it can also create this kind of errors, but that an issue to be reported there

You can use pnpm why vue to check the installed version and debug further and use pnpm update vue to update it but this goes beyond vue-demi’s responsibility