getActivePinia was called with no active Pinia. Did you forget to install pinia? #971
-
Hi. I am trying to convert to typescript but I get this problem when access the page:
I have the following in my main.ts file:```
If I comment out the 2 lines that use the store, then I do not get any errors. |
Beta Was this translation helpful? Give feedback.
Replies: 12 comments 29 replies
-
@bjorntj did you solve this error? Ok, it's most likely because you're calling |
Beta Was this translation helpful? Give feedback.
-
Vite + Vue project: This error occurs when using import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'
import { UserStore } from '@/store/UserStore'
const userStore = UserStore()
const routes: RouteRecordRaw[] = []
const router = createRouter({
history: createWebHistory(),
routes
})
router.beforeEach((to, from, next) => {
console.log(userStore)
next()
})
export default router |
Beta Was this translation helpful? Give feedback.
-
In my case, I'm using the script setup style and forgot to write setup inside the opening script tag. from this: const userDataStore = useUserDataStore(); should be like this: const userDataStore = useUserDataStore(); |
Beta Was this translation helpful? Give feedback.
-
Hi, everyone after a lot of research I found the answer to this issue, `<script lang="ts" setup> const counterStore = useCounterStore(store()); |
Beta Was this translation helpful? Give feedback.
-
i had the same problem when i used |
Beta Was this translation helpful? Give feedback.
-
Hi Guys, I created a tableau extension, in which I want to render a map component using pinia. This is how I try to load the app with map in the main.js file. main.jsimport { createApp } from 'vue'; const app = createApp(App); I'm getting this error. getActivePinia was called with no active Pinia. Did you forget to install pinia? Please let me know, any thing more require to render the pinia map inside a tableau extension. Thanks in advance, |
Beta Was this translation helpful? Give feedback.
-
Hi, guys maybe it will be helpful. I encountered this problem in After changing filename extension to |
Beta Was this translation helpful? Give feedback.
-
Hi Nikita Voloshin. You are correct. Anybody knows how to solve the error, when the map-store used as a js file? |
Beta Was this translation helpful? Give feedback.
-
I had the same issue and the reason was that I had not included the setup keyword in my script |
Beta Was this translation helpful? Give feedback.
-
I have the same problem. Can anybody help me please? |
Beta Was this translation helpful? Give feedback.
-
in my case in the router file use
instaed
solved my promble |
Beta Was this translation helpful? Give feedback.
-
import { createPinia } from 'pinia'; const pinia = createPinia(); |
Beta Was this translation helpful? Give feedback.
@bjorntj did you solve this error?
Ok, it's most likely because you're calling
useAuthStore()
from outside a component's setup, and it's called before Pinia is setup. #664 (comment)