Vue.js is throwing an error message saying, 'Unrecognized custom element: <ShowList>' while rendering in the browser

After setting up a basic boilerplate project using vue cli create, I made some small modifications that initially seemed to work fine. However, at one point, both of my components suddenly stopped working in the browser without any warnings from vue-cli-service serve.

Upon checking the browser console, I encountered an error message stating "Unknown custom element" for both of my elements.

Below is my main.js file:

import './sass/style.scss'
import Vue from 'vue'
import App from './App.vue'

Vue.config.productionTip = false

/*
new Vue({
  render: h => h(App)
}).$mount('#app')
*/

new Vue({
    el: '#app',
    template: '<App/>',
    render: h => h(App),
    components: { App }
}).$mount('#app');

Next, here is my App.vue file:

<template>
  <div id="app">
    <ShowList list_id="default"/>
  </div>
</template>

<script>
import ShowList from './components/ShowList.vue'

export default {
  name: 'app',
  components: {
    ShowList
  }
}
</script>

<script lang="scss">
@import "sass/common.scss";

// Static footer
.footer {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: $footer_height; /* Set the fixed height of the footer here */
  margin-bottom:0;
}

.navbar {
    margin-bottom:0;
}
</script>

Lastly, here is one of the components used:

<template>
    <div class="row">
            <div class="col-md-4 order-md-2 mb-4">
                    <h4 class="d-flex justify-content-between align-items-center mb-3">
                            <span class="text-muted">Your List</span>
                    </h4>

                    <ul class="list-group mb-3">
        <li v-for="beer in beers" v-bind:key="beer.name" class="list-group-item d-flex justify-content-between lh-condensed">                                                                                 
          <div>
            <h6 class="my-0">{{ beer.name }}</h6>
            <small class="text-muted">{{ beer.description }}</small>
          </div>
          <span class="text-muted">{{ beer.price }}</span>
        </li>
                  </ul>
            </div>
    </div>
</template>

<!-- Include script with data for demonstration -->
<script>
var beer_items = [
  {
    name: 'Hoegarden',
    price: '19:90 kr',
    description: 'German beer'
  },
  {
    name: 'Leffe',
    price: '16:90 kr',
    description: 'Belgian beer'
  },
  {
    name: 'Fat Tire',
    price: '17:50 kr',
    description: 'American beer'
  }
];

export default {
  name: 'ShowList',
  props: {
    list_id: String
  },
  data () {
    return {
      beers: beer_items
    };
  }
}
</script>

<!-- Scoped styling specific to this component -->
<style lang="scss" scoped>
.flip-list-move {
  transition: transform 0.5s;
}
.no-move {
  transition: transform 0s;
}
.ghost {
  opacity: .5;
  background: #C8EBFB;
}
.list-group {
  min-height: 20px;
}
.list-group-item {
  cursor: move;
}
.list-group-item i{
  cursor: pointer;
}
</style>

I've also tried using hyphenated component names like show-list, but unfortunately, it did not resolve the issue. It seems like I might have overlooked something simple yet essential, as no one on Vue Gitter has been able to pinpoint the exact problem so far.

Answer №1

Maybe the issue is related to using <script lang="scss"> instead of <style lang="scss"> tags in App.vue file?

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Adding images in ascending order according to the parent div's ID

If I have three different divs with unique IDs on a webpage <div id="product-id-001"></div> <div id="product-id-002"></div> <div id="product-id-003"></div> Is there a way to add image elements based on the ID of each d ...

Accordion not appearing on the webpage

I'm currently working on implementing a helpful feature at the bottom of my webpage to assist users with navigation. I was thinking of using an accordion as a dropdown helper, but I've been facing some challenges getting it to function properly. ...

Guide to accessing data from dot net core in React Native

Screenshot of Postman showing dot net core API Although Postman successfully fetches data from my dot net core API, I am encountering difficulties in retrieving the data in React Native using the same API. I have tried various solutions, including changin ...

CORS request results in unsuccessful cookie setting in browsers except for Firefox where Set-Cookie header is detected; notably, Chrome does not show the header

I'm experiencing an issue with setting cookies from a NodeJS server to the client using JQuery and AJAX. Despite seeing the Set-Cookie headers in the response, the cookies are not showing up in the document.cookie string. I would greatly appreciate it ...

Tips for stopping the textarea from moving around as you type and avoid it hitting the bottom of the page: Utilize JQuery and

As I type into the auto-sizing textarea, the text runs to the bottom of the page and causes it to dance uncontrollably with each key press. This forces me to constantly scroll down to see what's happening. How can I prevent this page dancing and keep ...

Using identical filters for two ng-repeats causes issues in AngularJS, as it only seems to work in one of them

I am encountering an issue with my search box where I am attempting to filter two items, but only one is filtering correctly. Here is the code snippet in question: <!--this is the input--> <input type="search" placeholder="Sports finder" ng-mode ...

Having trouble updating the route with the $location service, even after attempting to use $scope.apply

After trying to utilize the location service with no success, I am left wondering why my view isn't changing even after using either $scope.$apply() or $scope.apply. Prior to posting my question, I conducted thorough research on similar inquiries but ...

Solved error message: "The method ResponseFactory::toArray is not available."

In my current setup with Laravel 7.6 and Vue 2, I am facing an issue with converting a Laravel collection to an array. The original code that is working fine is as follows: public function index() { $books = Book::all()->toArray(); return array ...

Facing an issue with uploading images in the Update method using Laravel, Vue, and Inertia

I currently have a web application that features various articles, each accompanied by an image. The process of creating and storing new articles with images has been seamless. However, I've encountered some challenges when it comes to updating artic ...

Difficulty in presenting information retrieved from an AJAX JSON parsing operation

Take a look at my code on Codepen: http://codepen.io/dsemel/pen/VamEyE The following section of code is causing some trouble: function success(position){ var WeatherKey = '6068dffce2f44535a07202457162103'; var lat = position.coords.latitude; ...

Using JavaScript (without jQuery), take away the CSS class from an element

Seeking assistance from experts on the process of removing a class from an element solely using JavaScript. Kindly refrain from suggesting solutions involving jQuery as I am unable to utilize it, and have little knowledge about its functionalities. ...

Angular Position Animation with PhysicsJS

A juggling game is being created using PhysicsJS. The game consists of a ball in the shape of a circle and a shoe in the shape of a square using a convex-polygon. The shoe remains fixed and moves along the x-axis when the mouse is moved. The square shoe: ...

How to disable the underline link button feature in Vue.js and Vuetify

When working on the frontend of my project using Vue.js and Vuetify framework, I often use buttons. Here is an example: <v-btn class="ma-2" outlined color="success" width="150px" ...

Ensure that react-native-google-places-autocomplete is assigned a specific value rather than relying on the default value

I am currently using a functional <TextInput>: <TextInput placeholder="Location" value={props.locationInput.toString()} onChangeText={location => props.updateLocationInput(location)} /> Initially, the props.locationIn ...

React is giving me trouble as I try to map my tables. I am struggling to figure out how to do this

I have two .CSV files: "1.csv" and "2.csv". I need to display the data from each file in a table using the BootstrapTable component. My async functions, GetData(file) and FetchCSV(file), are working fine and providing the necessary array of objects for the ...

Having trouble with the express-stormpath login feature for users who have authenticated with their email?

As I run a basic node.js/Express server with express-stormpath for user authentication, everything runs smoothly without email verification. However, email verification is essential for various reasons; nevertheless, my email-verified users face issues whi ...

After upgrading, my npm is completely dysfunctional – it keeps showing the error "Cannot read property 'get' of undefined."

Recently, I updated Node.js to the latest version on my computer. Prior to the update, the 'npm' command functioned flawlessly in the command prompt. However, after installing the new version of Node.js, it stopped working completely. All comma ...

Obtaining weather information for a particular date through wunderground

Today marks my first experience using this wunderground service. My goal is to retrieve weather data under the following circumstances: Note : Today Date :2014-02-03 I am looking to access weather data ranging from 2014-01-21 to 2014-01-31, which fal ...

Struggling to implement Ajax functionality with JSF on a Tomcat 7.0 server

I am new to Ajax and struggling to get a simple example to work... Here is the javascript code: var xmlRequest; function refreshContent() { if (window.XMLHttpRequest) { xmlRequest = new XMLHttpRequest(); } else { x ...

HTML two-row horizontal list with truncation

My dilemma involves a horizontal list of items that expand the full width of their container and wrap onto the next line. However, I only want to show two lines of items initially, with a "show more" link to reveal additional rows in increments of two unti ...