Page not found: For the project deployed to Netlify via GitHub, clicking the link cannot find the corresponding page

My project contains multiple HTML files, including a jump relationship. When I upload the project to GitHub and then deploy it to Netlify, clicking the link in index.html will pop up an error message: Page Not Found.
When I looked at the file structure in Netlify’s folder, I found that many files were missing.

For the same project, if I upload it manually to Netlify, everything will run normally. Look at the file directory, there are also corresponding files. I don’t know why.


I looked through your recommendation post, but I still couldn’t find the corresponding solution or perhaps I misunderstood it.

My project address:

Deployed via GitHub:
https://code-learning-journal.netlify.app/

Manually uploaded:
https://code-learning-journal-manual.netlify.app/

@xph4444 What is your Build configuration set to? (or netlify.toml contents if you have one)

What’s the file structure in your repository? (Do you have a public link?)

@nathanmartin Below is my build configuration screenshot, I didn’t do anything with this part.

And the repository is here:

@xph4444 So lets step through what Netlify is doing based on those settings…

Starting with the files cloned from your repository:

Dependencies are installed, then it runs the Build command of npm run build which creates:

It then publishes the files in dist (which is the Publish directory):

image

This is all correct for a Vite based project, which builds into dist.
Your files are ‘missing’ but they’re not missing due to Netlify, it’s just what your build produces.

Uploading the source files directly is unfortunately a completely irrelevant comparison.

You should revisit the Vite documentation.
You’ll find that Vite doesn’t necessarily work how you currently believe that it does.

Relevant Vite Documentation Links:

Multi-Page App
https://vite.dev/guide/build.html#multi-page-app

The public directory
https://vite.dev/guide/assets.html#the-public-directory

vite preview
https://vite.dev/guide/cli#vite-preview
Try npm run build && npm run preview

Thanks for this detailed instruction, I really appreciate that.
I don’t know much about how Vite works. I will take a look at the document link you provided. Thank you! :grinning: