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.

[Vue warn]: Error in mounted hook: "Error: Container element not found"

See original GitHub issue

Hello,

I am using Wavesurfer 4.4.0

“wavesurfer.js”: “^4.4.0”

In vue, I am trying to use it as:

<div id="waveform" ref="waveform"></div>


import WaveSurfer from 'wavesurfer.js';


   mounted() {
        this.createWaveSurfer();
},


methods: {
        createWaveSurfer() {
            var wavesurfer = WaveSurfer.create({
                container: #waveform,
                waveColor: 'violet',
                progressColor: 'purple'
            });
            wavesurfer.on('ready', function () {
                wavesurfer.play();
            });
                wavesurfer.load(
                "https://mywebsite.com/storage/text/1611243371.wav"
            );
        },
}

I keep receiving this error:

[Vue warn]: Error in mounted hook: “Error: Container element not found”

Any idea why please?

Thank you.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8

github_iconTop GitHub Comments

1reaction
Benoit1980commented, Jan 25, 2021

Please give me till the weekend, and I will recheck it on my local machine as I am away at the moment. I will keep you updated.

Thank you so much for your efforts 😃

0reactions
sundayzcommented, Jan 25, 2021

Are you showing the full component? Are you using v-if somewhere to hide the <div>?

Refs should be available in the mounted hook, you can test this easily:

<template>
    <div ref="myref"></div>
</template>

<script>
export default {
    mounted() {
        console.log(this.$refs.myref); // should not be undefined
    }
}
</script>

In my project I load WaveSufer the same way as you do and it works.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Vuejs Leaflet : Map Container Not Found - Stack Overflow
When you try instantiating your Leaflet Map by passing it your Element id ( L.map('mapid') ), the problem is that your Vue component...
Read more >
Server-Side Rendering (SSR) - Vue.js
For browser-only APIs, the common approach is to lazily access them inside client-only lifecycle hooks such as mounted onMounted . Note that if...
Read more >
FAQ - qiankun - UmiJS
Application died in status NOT_MOUNTED: Target container with #container not existed while xxx mounting! This error usually occurs when the main app is...
Read more >
[Solved]-Vuejs Leaflet : Map Container Not Found-Vue.js
When you try instantiating your Leaflet Map by passing it your Element id ( L.map('mapid') ), the problem is that your Vue component...
Read more >
Understanding refs in Vue - LogRocket Blog
Refs are Vue.js instance properties used to register a reference to HTML ... this means that Vue does not see this as an...
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