question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unknown custom element: [ ... ] - did you register the component correctly?

See original GitHub issue

I’m getting this error for each html tag of Vuetify. I installed Vuetify using

npm install --save-dev vuetify

In my main.js I have :

const Vue = require("vue");
const Vuetify = require("vuetify");
const tracksList = require("./track-list.vue");

Vue.use(Vuetify);

trackList = new Vue({el: "#track-list", template: "<tracksList/>", components: {tracksList}});

The file track-list.vue is :

<template src="../templates/track-list-component.html"></template>
<script src="./track-list.js"></script>

In my template track-list-component.html, here is the part which uses Vuetify :

<div class="track-name-row"
                 v-on:click="expandTrack(project.structure.tracks.indexOf(track))"
                 @contextmenu="show">
                <li class="track-color-viewer"></li>
                <span>{{"Track "+project.structure.tracks.indexOf(track)}}</span>
                <img class="item-view" src="../assets/img/ic_view.svg" alt="view">
            </div>

            <v-menu offset-y v-model="showMenu" :position-absolutely="true" :position-x="x" :position-y="y">
                <v-list>
                    <v-list-tile>
                        <v-list-tile-title>test</v-list-tile-title>
                    </v-list-tile>
                </v-list>
            </v-menu>

The track-list.js is a simple Vue component :

//another component I am using : vuedraggable
const draggable = require("vuedraggable");

module.exports = {
    name: "track-list",
    components: {
            draggable
    },

    data() {
        return {
            //used for vuedraggable
            isDragging: false,
            //used for vuetify
            showMenu: false,
            x: 0,
            y: 0
        };
    }
}

For importing Vuetify, is there other things to do than installing Vuetify with npm and using Vue.use(Vuetify) in main.js? I am a bit lost and sad, this lib seems to be really great.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

6reactions
nekosaurcommented, Aug 22, 2017

Aah, I totally missed that you were using require and not import.

When a module does this

export default function foo() {}

the resulting export becomes

{
  default: foo
}

When you import, it will automatically import the default property (unless you specify anything else). require does not do this automatically, which is why you need to specify .default

2reactions
Sualtycommented, Aug 22, 2017

I found the solution, someone of StackOverflow gave me a solution By changing const Vuetify = require("vuetify") to const Vuetify = require("vuetify").default

…it works. But I don’t really understand what happened here.Going to check.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Solve "Unknown Custom Element" in Vue
Registering components correctly. In Vue, you need to register custom components before you can use them. Regular HTML tags like <div> , < ......
Read more >
Vue.js unknown custom element - Stack Overflow
component () , it registers components globally. You can create file, name it MyTask. vue, export there Vue object https://v2.vuejs.org/v2/guide ...
Read more >
Unknown custom element, did you register the component ...
Hi all, I've run into a really weird problem. I've got 2 circular components which represent a graph, it's super simple.
Read more >
[Vue warn]: Unknown custom element: <example-component>
[Vue warn]: Unknown custom element: <example-component> - did you register the component correctly? Laravel comes with example-component right our of the box, ...
Read more >
Solution to Vue.js Error - Unknown custom element - did you ...
I'm building a recursive Vue.js component and ran into this error: Unknown custom element: - did you register the component correctly?
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found