Установил Pinia как положено через
npm install pinia
.
Затем зарегистрировал вот так:
import { createApp } from "vue";
import { createPinia } from "pinia";
import App from "./App.vue";
import router from "./router";
import store from "./store";
const Pinia = createPinia();
createApp(App).use(Pinia).use(store).use(router).mount("#app");
И затем использую в файле вот так вот:
<script>
import { useStore } from "../stores/Store.js";
const store = useStore();
export default {
....
}
</script>
Но при загрузке страницы в веб-браузере выходит вот такая ошибка:
: "getActivePinia()" was called but there was no active Pinia. Did you forget to install pinia?
const pinia = createPinia()
app.use(pinia)
This will fail in production.
Error: []: "getActivePinia()" was called but there was no active Pinia. Did you forget to install pinia?
const pinia = createPinia()
app.use(pinia)
This will fail in production.
at useStore (webpack-internal:///./node_modules/pinia/dist/pinia.mjs:1725:19)
at eval (webpack-internal:///./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./src/Another/Catalog.vue?vue&type=script&lang=js:8:73)
at ./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./src/Another/Catalog.vue?vue&type=script&lang=js (http://localhost:8080/js/app.js:162:1)
at __webpack_require__ (http://localhost:8080/js/app.js:1414:33)
at fn (http://localhost:8080/js/app.js:1647:21)
at eval (webpack-internal:///./src/Another/Catalog.vue?vue&type=script&lang=js:5:148)
at ./src/Another/Catalog.vue?vue&type=script&lang=js (http://localhost:8080/js/app.js:448:1)
at __webpack_require__ (http://localhost:8080/js/app.js:1414:33)
at fn (http://localhost:8080/js/app.js:1647:21)
at eval (webpack-internal:///./src/Another/Catalog.vue:3:94)
В чем проблема?
Уже изрядно достал своей кривостью этот Vue => писал на Реакте и ни разу не было ни единой проблемы, а тут сплошняком одни косяки, которые явно не по моей вине.
Судя по файлу package-lock.json у меня вот такая версия Vue и Pinia:
"pinia": "^2.1.6",
"vue": "^3.2.13",
"vue-router": "^4.0.3",
В общем помогите, буду очень благодарен.
Спасибо!