error caught during app initialization TypeError: Cannot set property $pinia of #<Object> which has only a getter #2781
Unanswered
Lionberg
asked this question in
Help and Questions
Replies: 2 comments
-
yes, i encounter this too, if i dont declare plugin to use it, im getting getActivePinia without app.use(pinia)} |
Beta Was this translation helpful? Give feedback.
0 replies
-
i think this is due to @pinia/nuxt |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Reproduction
impossible to add nuxt.config.ts in playground
Steps to reproduce the bug
Follow instructions at the docs: https://pinia.vuejs.org/ssr/nuxt.html
install:
npx nuxi@latest module add pinia
add to package.json:
"overrides": {
"vue": "latest"
}
// nuxt.config.js
export default defineNuxtConfig({
// ... other options
modules: [
// ...
'@pinia/nuxt',
],
})
Get the error in console:
error caught during app initialization TypeError: Cannot set property $pinia of # which has only a getter
P.S. These instructions says nothing about creating plugin and defining a store. Maybe docs needs a link there?
Expected behavior
use your store as usual
Actual behavior
impossible to use your store as usual -- client error, and error in nuxt: Cannot set property $pinia of # which has only a getter
Additional information
removing '@pinia/nuxt' from modules solves the issue.
But pinia does not keep state during page refreshes
Beta Was this translation helpful? Give feedback.
All reactions