nicolasbeauvais/vue-social-sharing

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

shaman-tech opened this issue · 8 comments

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

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

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)

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)
})

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?

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.

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.

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

stale commented

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.