nicolasbeauvais / vue-social-sharing

A renderless Vue.js component for sharing links to social networks, compatible with SSR
https://nicolasbeauvais.github.io/vue-social-sharing/
MIT License
1.39k stars 196 forks source link

Cannot restart nuxt: Cannot read properties of undefined (reading 'Index') #334

Closed shaman-tech closed 1 year ago

shaman-tech commented 1 year ago

When I install the package using Nuxt3 and Vue3. Nuxt fails to load when 'vue-social-sharing/nuxt' is added to modules in nuxt.config.ts

danplaton4 commented 1 year ago

Any updates on this, I'm still getting this error when starting a dev server.

aungzawpyae commented 1 year ago

Cannot start nuxt: Cannot read properties of undefined (reading 'Index') 09:18:44

at nuxtVueWaitModule (node_modules/vue-social-sharing/nuxt/index.js:21:50) at installModule (node_modules/@nuxt/kit/dist/index.mjs:416:9) at async initNuxt (node_modules/nuxt/dist/index.mjs:1825:7) at async load (node_modules/nuxi/dist/chunks/dev.mjs:6779:9) at async Object.invoke (node_modules/nuxi/dist/chunks/dev.mjs:6840:5) at async _main (node_modules/nuxi/dist/cli.mjs:50:20)

doseofted commented 1 year ago

I'm facing this issue as well on Nuxt 3. I'm using the module as a Vue plugin as a workaround.

~/plugins/socialSharing.ts:

import VueSocialSharing from "vue-social-sharing"

export default defineNuxtPlugin((nuxtApp) => {
    nuxtApp.vueApp.use(VueSocialSharing)
})
gspgsp commented 1 year ago

same question: ERROR Cannot start nuxt: Cannot read properties of undefined (reading 'Index') 09:31:17

at nuxtVueWaitModule (node_modules/vue-social-sharing/nuxt/index.js:21:50)

how to solve this?

YasCoMa commented 1 year ago

I'm facing this issue as well on Nuxt 3. I'm using the module as a Vue plugin as a workaround.

~/plugins/socialSharing.ts:

import VueSocialSharing from "vue-social-sharing"

export default defineNuxtPlugin((nuxtApp) => {
  nuxtApp.vueApp.use(VueSocialSharing)
})

This one worked and the nuxt v3 app rendered with no serious exceptions. But when i click in the social media links, it does not open the window to share.

gspgsp commented 1 year ago

ok,this solved my problem. i defined a plugin in plugins/vue-social-sharing.ts

import { defineNuxtPlugin } from '#app' import VueSocialSharing from "vue-social-sharing"; export default defineNuxtPlugin((nuxtApp) => { nuxtApp.vueApp.use(VueSocialSharing); }

and in vue template:

  <div>
    <ShareNetwork
        network="Facebook"
        url="https://news.vuejs.org/issues/180"
        title="Say hi to Vite! A brand new, extremely fast development setup for Vue."
        description="This week, I’d like to introduce you to 'Vite', which means 'Fast'. It’s a brand new development setup created by Evan You."
        quote="The hot reload is so fast it\'s near instant. - Evan You"
        hashtags="vuejs,vite"
    >
      Share on Facebook
    </ShareNetwork>
  </div>

it worked very well.

NidhalBB commented 1 year ago

Any updates on this, I'm still getting this error !

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.