Dholu
Dholu

Reputation: 697

I built my Vuejs app by running npm run build, opening index.html throws errors: Failed to load resource: net::ERR_FILE_NOT_FOUND

I ran npm run build, successfully created Dist folder, now opening index.html throws error :Failed to load resource: net::ERR_FILE_NOT_FOUND

what can be the possible issue here ?

Upvotes: 1

Views: 2310

Answers (2)

Dholu
Dholu

Reputation: 697

I found adding

module.exports = {
    publicPath: './'
};

to vue.config.js solves it too, after which we can open index.html from the dist folder directly.

More about publicPath in the docs.

Upvotes: 3

Anderson Ivan Witzke
Anderson Ivan Witzke

Reputation: 1549

Vue JS files are not supposed to simply be opened directly in the browser (using the file:// protocol). You must use a server for it to correctly work. The simplest solution if you use Google Chrome is to use this extension: Web Server for Chrome

Upvotes: 2

Related Questions