Unknown custom element - did you register the component correctly?

25,537

This is really old question but answering so that future visitors might get help:

Custom element shouldn't be self closed:

<information :bleh="{}" />

Make sure to use like this:

<information :bleh="{}"></information>

Thanks to @connexo for the comment:

Also for compliance with official web components, make sure you use a dashed tag like <information-component ...></information-component>

For those who get error with the following:

Did you register the component correctly?

Make sure to apply the name option in your component

Share:
25,537
Gabriel Robert
Author by

Gabriel Robert

Updated on July 09, 2022

Comments

  • Gabriel Robert
    Gabriel Robert almost 2 years

    I'm currently using webpack with vuejs 2. I have a very basic component [Main.vue] that is rendered by vue-router and inside this component, I want to have another one [Information.vue]. For some reason, I can't render it properly.

    components/test/Information.vue

    <template>
        <div>
        TEST
        </div>
    </template>
    
    <script>
    export default {
      name: 'information',
      props: {
        bleh: {
          type: Object,
          required: true
        }
      }
    }
    </script>
    

    components/test/injex.js

    export { default as Main } from './Main'
    export { default as Information } from './Information'
    

    components/test/Main.vue

    <template>
        <information :bleh="{}" />
    </template>
    
    <script>
    import { Information } from 'components/test'
    export default {
      name: 'main',
      components: { Information  }
    }
    </script>
    

    Any idea why I get the following error ?

    [Vue warn]: Unknown custom element: <information> - did you register
    the component correctly? For recursive components, make sure to
    provide the "name" option