Solution to Vue.js Error - Unknown custom element - did you register the component correctly? For recursive components, make sure to provide the name option.

I’m building a recursive Vue.js component and ran into this error:

Unknown custom element: <Categories> - did you register the component correctly? For recursive components, make sure to provide the "name" option.

My @Component registration looked like this:

@Component(&#123;
  components: &#123;
    RatingBar,
    Items,
    Categories
  &#125;
&#125;)

The solution is super-simple, but non-obvious.

You just need to add a name property like so:

@Component(&#123;
  name: 'Categories',
  components: &#123;
    RatingBar,
    Items,
    Categories
  &#125;
&#125;)

And the problem is solved.

Hope this helps.

Jon