question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

@pinia/nuxt doesn't work with nuxt bridge

See original GitHub issue

Reproduction

https://codesandbox.io/s/brave-danilo-n1de5

Steps to reproduce the behavior

Create a project with nuxt-bridge and @pinia/nuxt. npm run dev Open in browser.

Expected behavior

No error.

Actual behavior

500
Cannot read properties of undefined (reading 'install')
at Function.Vue.use (file://./.nuxt/dist/server/server.mjs:7842:23)
at $id_c39524e4 (file://./.nuxt/dist/server/server.mjs:20715:7)
at async __instantiateModule__ (file://./.nuxt/dist/server/server.mjs:20913:3)

Additional information

N/A

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
BobbieGoedecommented, Dec 21, 2021

I managed to workaround the Cannot read properties of undefined (reading 'install') issue by adding an alias to the vite config in nuxt.config. This gave me a different error: [vue-composition-api] must call Vue.use(VueCompositionAPI) before using any function.

Adding the following to nuxt.config got rid of both errors for me.

vite: {
    optimizeDeps: {
        exclude: ['pinia'],
    },
    resolve: {
        alias: {
            pinia: path.resolve(__dirname, './node_modules/pinia/dist/pinia.mjs'),
        },
    },
}
0reactions
shinguweb96commented, Dec 22, 2021

with vite is getting the error:

Cannot read properties of undefined (reading 'install') at Function.Vue.use (file://./.nuxt/dist/server/server.mjs:7842:23) at $id_c39524e4 (file://./.nuxt/dist/server/server.mjs:20715:7) at async __instantiateModule__ (file://./.nuxt/dist/server/server.mjs:20913:3)

Read more comments on GitHub >

github_iconTop Results From Across the Web

pinia/nuxt doesn't work with nuxt bridge · Issue #889 - GitHub
I managed to workaround the Cannot read properties of undefined (reading 'install') issue by adding an alias to the vite config in nuxt.config...
Read more >
Nuxt.js - Pinia
Using Pinia with Nuxt.js is easier since Nuxt takes care of a lot of things when it comes to server side ... Pinia...
Read more >
Integrating Nuxt Bridge into a Nuxt 2 Project | Cody Bontecou
I followed the Nuxt Bridge documentation. The maintainers of the documentation did a great job of walking me through the process of migrating...
Read more >
Recently Active 'nuxtjs3' Questions - Stack Overflow
Hello I'm currently having issues with the integration of pinia in Nuxt3 whenever I run npm run dev it give me a warning....
Read more >
nuxt-bridge-pinia-error - CodeSandbox
CodeSandbox is an online editor tailored for web applications.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found