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.

No error message when index.html file is missing

See original GitHub issue

Describe the bug

If there is no index.html file present then running vite shows no errors and trying to access the page will give a 404 server error. Although having a missing index.html file is obviously wrong and unlikely to happen if using the cli, it’s easy to forget to add one if migrating an existing project from web pack to vite. I would expect vite to show some error message that no html file was found.

Reproduction

  1. Use the cli to create a vite project.
  2. Remove the index.html file.
  3. Run ‘npm run dev’

There will be no error message. Trying to access the page will show a 404 error.

System Info

  • vite version: 2.0.0-beta.30
  • Operating System: MacOS 11.1
  • Node version: 14.4.0
  • Package manager (npm/yarn/pnpm) and version: npm 6.14.11

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
yyx990803commented, Jan 16, 2021

To serve custom virtual html you need to add a custom middleware using the configureServer plugin hook because HTML is not handled as part of the normal transforms during dev.

0reactions
yyx990803commented, Jan 17, 2021

Closing since this is expected - open to a PR to provide more descriptive error message for this though.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What Is Index.html? How To Repair It? [SOLVED] - Solvusoft
HTML problems with index.html most often stem from a corrupt or missing Windows file. Replacing your HTML file is generally a solution to...
Read more >
InMotion Hosting - YouTube
How to Fix the " Index Of /" Error - Missing index .htm/. html /.php File on Apache ... This is caused by...
Read more >
HTML Files are missing - WordPress.org
The downloaded only has the wp-content and the wp-includes folder an the index.html, but all the other HTML files are missing. What I...
Read more >
Error in production build: Index html generation failed [closed]
The error is not in the index.html file that you see in the folder structure. It occurs on generating the final index.html.
Read more >
"Missing index.html" Errors Filling HTTP Server Error Log
At some point the index.html file in the directory defined in the DocumentRoot directive was removed or permissions were changed to make it ......
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