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({
components: {
RatingBar,
Items,
Categories
}
})

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

You just need to add a name property like so:

@Component({
name: 'Categories',
components: {
RatingBar,
Items,
Categories
}
})

And the problem is solved.

Hope this helps.

Jon