You have encountered an issue with the runtime-only build of Vue, which does not include the template compiler

Lately, I have been utilizing Vue in a project and encountered an issue where upon compiling, my browser page displays as white with an error message stating "You are using the runtime-only build of Vue where the template compiler is not available. Either pre-compile the templates into render functions, or use the compiler-included build." showing up in the browser console.

This is the structure present in my index.html file:

<body id="page">
    <div id="app">
      
      <h1>{{Title}}</h1>

      <input type="text" placeholder="Username" id="input" v-model="username"/>
      
      <div>
        <button id="button" v-on:click="play">Play</button>
      </div>

      <h1>{{Records}}</h1>

      <dl id="list">
        <dt v-for="user of users" id="data">
          {{user.Username}} - {{user.Score}}
        </dt>
      </dl>
    </div>

    <script src="Views/welcomePage.js"></script>
  </body>

In this case, I am importing Vue within my welcomePage.js file and it's crucial that I specifically import 'vue' rather than changing it to 'vue/dist/vue.js'. This is because I need to export the data stored in the username variable after information is inputted on the HTML file.

window.axios = require('axios');
import Vue from 'vue';

var app = new Vue({
    el: '#app',
    data:{
        Records: 'Records',
        Title: 'Snake',
        users:[],
        username: '',
    },

    mounted: function(){
        axios.get('http://localhost:3000')
            .then(res => this.users = res.data);
    },

    methods:{
        play(){
            console.log(app)
            window.location.href = 'snake.html'
        } 
    }
})

export default app.$data.username

My primary concern now is how can I resolve the display issues on my webpage?

Answer №1

It should be pretty straightforward - you're utilizing a variant of vue.runtime.js as opposed to the standard vue.js.

You can find a clear breakdown of the various builds in the documentation here.

The runtime-only build is more compact, but is specifically designed for different scenarios, such as when working with Vue CLI and npm run (a widely used method for Vue) or if you're directly calling html-rendering functions via JavaScript (less common).

You'll want either the "full" build, or the "full (production)" build, both of which include the template compiler. It's likely linked in your HTML page, so simply update your reference to the correct vue.js 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

Guide on utilizing "setFont" in jsPDF with UTF-8 encoding?

Currently working on a project using Angular 7 I am trying to incorporate a custom font (UTF-8) into my PDF generation service using jsPDF. Despite researching various examples, none seem to work for me. The documentation on the jsPDF GitHub page mentions ...

Guide to personalizing the variables in Vuetify within a Laravel project

Currently, I am incorporating vuetify within Laravel. My Laravel 8 project is set up with Vue version 2 using the laravel/ui package. So far, everything appears to be functioning correctly with all vuetify components rendering as expected. However, when at ...

Tips for exiting a function at a particular point

How can I ensure that my async function only returns at a specific point and not void at the end? const fun = () => { const list = []; let streamFinished = 0; let streamCount = files.length; await fs.readdir(JSON_DIR, async(err, files) => ...

What is the best way to auto-fill input fields with data from a Json file

My goal is to automatically populate HTML form fields based on user selection. I have obtained code for related functions, such as fetching JSON data and creating dropdown lists, from a friend. Here is the link to that code: https://jsfiddle.net/r4zuy7tn/1 ...

The client continues to request the file through the REST API

I have noticed a behavior with an audio file stored on the server that clients can request via a REST API. It seems that every time the audio is played again, a new request is sent to the server for the file. Is there a way to prevent this or cache the dat ...

Fetching a JSON object from an external URL using JavaScript

Currently, I am working on a project using JavaScript and have an API that provides me with a JSON Object. You can access this JSON object by clicking on the following link: . Within this JSON object, there is a specific element located at JSONOBJECT.posi ...

How to make an AJAX request in jQuery / JavaScript after a specific time interval has passed

Here is the code snippet I'm working with: $('input.myinput').each(function(){ var id = $(this).val(); var myajax = function(){ $.ajax({ url: ajax_url, type: "GET", data: ({ code: id ...

The Vuetify theme seems to be getting overlooked

I recently created a file in my plugins directory with the following code snippet: import Vue from "vue"; import Vuetify from "vuetify/lib/framework"; Vue.use(Vuetify); export default new Vuetify({ theme: { themes: { light ...

Assigning nested JSON values using Jquery

My JSON data structure is as follows: { "Market": 0, "Marketer": null, "Notes": null, "SalesChannel": null, "ServiceLocations": [ { "ExtensionData": null, "AdminFee": 0, "CommodityType": 0, ...

Tips on creating a hierarchical ul list from a one-dimensional array of objects

I have an array filled with various objects: const data = [ {id: "0"},{id: "1"},{id: "2"},{id: "00"},{id: "01"},{id: "02"},{id: "11"},{id: "20"},{id: "23"},{id: & ...

Will synchronous programming on an Express server prevent other users from accessing the page simultaneously?

Currently working on a simple one-page web app that depends on loading weather data from a file. To avoid multiple HTTP requests for each visitor, I have a separate script refreshing the data periodically. In this particular instance, I am using fs.readFi ...

Looking to incorporate HTML5 videos into a responsive Bootstrap carousel?

I've been working on creating a carousel that includes videos. When it comes to images, everything works smoothly as they are responsive even in mobile view. However, I'm encountering an issue with videos where the width is responsive but the hei ...

Why do I keep encountering the error of an undefined variable? Where in my code am I making a mistake

I am struggling to troubleshoot an issue with creating a simple ease scroll effect using the jQuery plugins easing.js and jquery-1.11.0.min.js. $(function(){ //capturing all clicks $("a").click(function(){ // checking for # ...

Avoid special characters (metacharacters and diacritical marks)

When my program consumes data from an API, it receives the following output: "<a href=\"http:\/\/www.website2.com\/\" target=\"_blank\">Item card<\/a>","<img src=\"https:\/\/website.com ...

Rendering Koa without the need for a template engine

Currently, I am in the process of practicing my skills with Node.js and have made the decision to begin with Vue + Koa. Upon studying Vue, I have come to the realization that perhaps using a template engine is unnecessary. Instead, I can simply respond wi ...

Issue: encountered a write EPIPE error while attempting to transfer a file to FTP via gulp

Whenever I try to deploy some stylesheets to a server using FTP, I encounter an error about 80% of the time. Here's the specific error message: Error: write EPIPE at _errnoException (util.js:1022:11) at WriteWrap.afterWrite [as oncomplete] (net.j ...

`Achieving efficient keyboard navigation with MUI Autocomplete and SimpleBar integration in React``

Currently, I am attempting to integrate the Simplebar scrollbar into the MUI Material Autocomplete component in place of the default browser scrollbar. While everything is functioning correctly, this customization has caused me to lose the ability to use t ...

What is the best way to link y and x coordinates to an image in a Vue component?

Looking for assistance on how to move an image with mouse click. I have successfully configured x and y mouse movement, but unsure of how to connect these coordinates to the image. Any guidance would be greatly appreciated! Using VUE.JS ...

Alter the background color of a div contingent on the checkbox being checked within

I am in search of a solution to modify the background color of a parent div that contains a checkbox. The condition is that the background color should only change when the 'checked' attribute is present within the tag. HTML <div class="comp ...

In the world of Node.js and Java, the concepts of "if"

Here is a code snippet that I am working with: var randFriend = friendList[Math.floor(Math.random() * friendList.length)]; if (randFriend == admin) { //Do something here } else if (randFriend != admin) { client.removeFriend(randFriend); } I am tr ...