Can you build and run a production-ready Vue application on your local system?

After running the npm run build command in my vue project, I placed the dist folder in C:\xampp\htdocs\ and launched the apache server to test the app on my local machine. However, when I try to access http://localhost/dist/index.html in my browser, all I see is a blank white page. Is there any way to successfully run the production build locally?

Answer №1

If you're working with Vue3, don't forget to include the following in your package.json

"scripts": {
  "preview": "vite preview",
},

For those not using Vue3, consider trying out serve, an excellent alternative for previewing single page applications without the need for a XAMPP server. It can be installed globally on your machine.

If Vite is unavailable (such as in a Vue2 project) or if you simply want to quickly preview a static application, run the following command:

serve dist

Note: Windows users might need administrator permissions to execute this command.

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

How does the call method on array.prototype.includes work with arguments x and y?

Curious about the functionality of array.prototype.includes.call(x, y);. Discovered that includes() confirms if an array has the specified value and provides a true or false result. Learned that call() invokes this alongside any optional arguments. The ...

Using D3-GraphViz in Javascript along with an Angular template: A step-by-step guide

I am attempting to integrate d3-graphviz following the guidance provided here within an angular template, like in this example. The tutorial on the d3-graphviz website advises me to include the following code in the index.html file: <!DOCTYPE html> & ...

Chokidar encountered an issue on drive D: due to a locked or busy resource, resulting in an error when attempting to access 'D:pagefile.sys'

Today, I encountered an issue when trying to run my Vue app using the npm run serve command. Although I have done this many times before with the same repository, it threw an error at me when I attempted to start it up recently. This dependency was not fou ...

Jest may come across test suites, but it discreetly disregards the individual tests

Having encountered an issue with Jest testing in a Nuxt/Vue v2 project, I found that after making some changes, the tests were no longer running. The unit tests were either passing or failing initially, but suddenly stopped running altogether. ----------|- ...

Pattern matching in JavaScript using regular expressions is used to identify and extract repeating patterns,

There is a specific string that contains structured data and multiple instances of @doc { within it. I need to extract these occurrences, making sure the result includes two unique matches. To achieve this, regular expressions come in handy: var matches = ...

Encountering a problem where updating the selected option in a dropdown does not properly refresh the HTML

I am currently working with a dropdown menu containing countries. Initially, the selected item is set to Ukraine. <select id="country" name="country"> <option value="US">USA</option> <option value="UG">Uganda</option> ...

Unable to fetch permissions for user:email via GitHub API

Currently, I am utilizing node-fetch to fetch an OAuth2 token from an OAuth2 GitHub App. The obtained token allows me to successfully retrieve user information from "https://api.github.com/user". However, I also require the email address, which necessitate ...

Guide: Generating a dynamic textbox on click event without needing to reload the page

I need assistance with the following form:- <form action=""> <table border="0"> <td colspan="2" class="instruction">Please select an option to search.</td> </table> <table> <tr> ...

Can one access non-static methods within React Navigation's navigationOptions?

Within my form, I am trying to position a submit button to the right of the header that triggers the same method as the submit button located at the bottom of the form. React Navigation necessitates the declaration of a static method named navigationOptio ...

The child user interface component is failing to respond to keypress events within the parent component in an Angular project

I am facing a challenge in adding a keyboard shortcut to open a nested child UI Tab component through a keypress event. However, the Child nested tab can only be loaded after the Parent component is loaded first. Below is the structure of the UI tree: |-- ...

Update your Selenium WebDriver Manager using npm

When attempting to update the selenium webdriver using the "webdriver-manager", an error occurred: Error: Got error Error: read ECONNRESET from https://selenium-release.storage.googleapis.com/2.48/selenium-server-standalone-2.48.2.jar Error: Got error Err ...

Transferring shapes from a two-dimensional equirectangular view to surfaces in A-Frame

Currently, my goal is to create a hotspot editor for 360-degree images using A-Frame. The concept behind this project involves allowing users to draw on an equirectangular panorama and then having the tool convert those drawings into planes using THREE.Sh ...

Combining various datasets with identical X values in a D3 bar graph

I'm currently working on creating a grouped bar chart to display performance test results using D3 for the first time. The X axis should represent parallelism, indicating the number of threads used, while the Y axis will show the duration in millisec ...

Angular 10 and Typescript: Variables assigned within the change event become undefined

In my code, I initialize an Algolia input and set an onchange event to it. This initialization takes place in a service. algolia_data; random_var; this.http.post<any>('APIENDPOINT', formData).subscribe(data => { instance = places({ ...

What is the best way to retrieve the current value of a range slider?

Having some trouble with the "angular-ranger" directive that I loaded from a repository. Can anyone assist me in figuring out how to retrieve the current value of the range slider? Any guidance or suggestions would be greatly appreciated! For reference, ...

Generate a PDF file using a byte array and save it for download

I am working on an AJAX function that calls a server-side method which in turn calls an API and returns a byte array. My goal is to convert this byte array into a PDF file and then download the file. Here is the code I have: AJAX function: function Obtai ...

Embed script tags into static HTML files served by a Node.js server

Looking to set up a Node server where users can request multiple pages from a static folder, and have the server inject a custom tag before serving them. Has anyone had success doing this? I've tried with http-proxy without success - not sure if a pro ...

Exploring a nested JSON structure using AngularJS's Ng-Repeat directive

I am facing an issue with displaying all elements of subcategory using Ng-Repeat. I have managed to show all events from the selected category with this code, but I am unsure how to display all activities from a specific event. I currently have this code.. ...

What could be causing my Alert component to keep triggering repeatedly?

This is my custom React Native script. import React, { useState, useEffect } from 'react'; import { Alert, View, Image, StyleSheet, Animated, Easing, TouchableOpacity, Text, ScrollView, ImageBackground, Dimensions, TextInput } from 'react-na ...

Is it possible to execute a block in a v-for loop over an object just once in vue

My current challenge involves handling an object with the following structure: object: { "prop1": [], "prop2": [], "prop3": [], } Within my template, I aim to iterate over this object and display data in each of the props. However, if there is no data ...