Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot read properties of undefined (reading 'version') #17

Open
burmesepotato opened this issue Nov 20, 2021 · 3 comments
Open

Comments

@burmesepotato
Copy link

I'm getting this error when trying to use in my Vue3 project. Anybody encountered this before?

TypeError: Cannot read properties of undefined (reading 'version')
at eval (index.mjs?4c81:15)
at Module../node_modules/@vueuse/sound/node_modules/vue-demi/lib/index.mjs (home.js:59)
at webpack_require (app.js:854)
at fn (app.js:151)
at eval (index.js?af75:1)
at Module../node_modules/@vueuse/sound/dist/esm/index.js (home.js:35)
at webpack_require (app.js:854)
at fn (app.js:151)
at eval (cjs.js?!./node_modules/babel-loader/lib/index.js!./node_modules/cache-loader/dist/cjs.js?!./node_modules/vue-loader-v16/dist/index.js?!./src/views/Game.vue?vue&type=script&lang=js:3)
at Module../node_modules/cache-loader/dist/cjs.js?!./node_modules/babel-loader/lib/index.js!./node_modules/cache-loader/dist/cjs.js?!./node_modules/vue-loader-v16/dist/index.js?!./src/views/Game.vue?vue&type=script&lang=js (home.js:131)

Basically, what I'm trying to achieve is to play the audio when user clicks 'yes' on the <Modal /> component which emits startGame

Here is the code:

<template>
  <Modal @startGame="startGame" />
</template>

<script>
import { useSound } from '@vueuse/sound'
import bgAudio from '@/assets/audio/stranger-things.mp3'

export default {
  setup() {
      const { play } = useSound(bgAudio)

     const startGame = () => {
        /* other codes here */
        play()
    }
    return {
      startGame
    }
  }
}
</script>
@itwseood
Copy link

Having the same issue. I think it is caused by some misconfiguration in vue-demi. I am using Vue ^3.0.0, and having similar error. In Eslint I am getting:

warning in ./node_modules/@vueuse/sound/node_modules/vue-demi/lib/index.mjs
"export 'default' (imported as 'Vue') was not found in 'vue'

warning in ./node_modules/@vueuse/sound/node_modules/vue-demi/lib/index.mjs
"export 'default' (reexported as 'Vue') was not found in 'vue'

@Sirttas
Copy link

Sirttas commented Jun 28, 2022

I also encounter this issue on a vue 3 project. Any workaround?

@Tahul
Copy link
Member

Tahul commented Nov 25, 2022

Hey, could you let me know if v2 has fixed this issue for you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants