Search code examples
javascriptvue.jsc3.js

Failed to mount component: using vue-c3


I tried using https://www.npmjs.com/package/vue-c3 for rendering my c3 charts in vue. It worked some time ago, but now it started giving (in VueC3):

"vue.runtime.esm.js?ff9b:587 [Vue warn]: Failed to mount component: template or render function not defined."

even when using a code from a tutorial:

<template>
 <div>
  <vue-c3 :handler="handler"></vue-c3>
 </div>
</template>

<script>
 import Vue from 'vue'
 import VueC3 from 'vue-c3'

 export default {
  name: ...,
  components: {
   VueC3
  },

  data () {
    return {
    handler: new Vue()
   }
  }
}
</script>

How can I fix this?


Solution

  • I faced the same exact problem. In my case it seems the bug was introduced after upgrading vue-c3 package to its latest version (v1.2.5 at the time of writing).

    What I did was to temporarily stick to our previous version (v1.1.1) in package.json (until it is fixed):

    { "vue-c3": "1.1.1" }

    and worked again.