0
votes

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

2
so did you registered your component? The error is asking you as well. Share some code, not just an error message.nakov

2 Answers

0
votes

The error your are getting is probably because your forgot to register your component inside your app.js :

new Vue({
    components: {
        PreviewComponent,
    },

Or you forgot to add name to your component inside the <script> tags of your component:

export default {
    name: 'preview-component',
    ...
}

After you register, don't forget to run npm again. This should solve your issue.

0
votes

Are you using the recursive component registration in app.js?

const files = require.context('./', true, /\.vue$/i)
files.keys().map(key => Vue.component(key.split('/').pop().split('.')[0], files(key).default))

If so, then you'll need to specify the name in the component explicitly in kebab-case:

<script>
export default {
  name: 'preview-component'
...
}
</script>

or

Don't register a name in the component and name the file using Pascal case: PreviewComponent.vue