Netlify does not deploy every html file from my Github repository

Hello,

currently I am doing a school project where I am creating a website using html, scss, Javascript, and Vite as the front-end tool.

For now I have an index.html and fetch.html file in my main branch but when I deploy the branch to Netlify it only deploys the index.html file and script file. Does anyone know how come?

This is the live website: https://responsible-it-3.netlify.app/
This is the repo: GitHub - cheunyinz/responsible_it_3_information_design

Production log

3:44:33 PM: Waiting for other deploys from your team to complete. Check the queue: Netlify App
3:44:40 PM: build-image version: 1ca34a93198b041e44214013884c57d146a23fed (focal)
3:44:40 PM: build-image tag: v4.16.4
3:44:40 PM: buildbot version: 30bb0dbce9c066d58cbd3a36ad34f8c91a4777a3
3:44:40 PM: Fetching cached dependencies
3:44:40 PM: Starting to download cache of 75.4MB
3:44:41 PM: Finished downloading cache in 763ms
3:44:41 PM: Starting to extract cache
3:44:41 PM: Finished extracting cache in 430ms
3:44:41 PM: Finished fetching cache in 1.233s
3:44:41 PM: Starting to prepare the repo for build
3:44:41 PM: Preparing Git Reference refs/heads/main
3:44:42 PM: Parsing package.json dependencies
3:44:43 PM: Starting build script
3:44:43 PM: Installing dependencies
3:44:43 PM: Python version set to 2.7
3:44:43 PM: Started restoring cached Node.js version
3:44:44 PM: Finished restoring cached Node.js version
3:44:44 PM: v16.19.0 is already installed.
3:44:44 PM: Now using node v16.19.0 (npm v8.19.3)
3:44:44 PM: Enabling Node.js Corepack
3:44:45 PM: Started restoring cached build plugins
3:44:45 PM: Finished restoring cached build plugins
3:44:45 PM: Attempting Ruby version 2.7.2, read from environment
3:44:45 PM: Using Ruby version 2.7.2
3:44:45 PM: Using PHP version 8.0
3:44:45 PM: Started restoring cached corepack dependencies
3:44:45 PM: mv: cannot move ‘/opt/build/cache/.node/corepack’ to ‘/opt/buildhome/.node/corepack’: No such file or directory
3:44:45 PM: Finished restoring cached corepack dependencies
3:44:45 PM: No npm workspaces detected
3:44:45 PM: Started restoring cached node modules
3:44:45 PM: Finished restoring cached node modules
3:44:45 PM: Bypassing sha validation. Running pre & post install scripts
3:44:46 PM: Installing npm packages using npm version 8.19.3
3:44:46 PM: up to date, audited 69 packages in 347ms
3:44:46 PM: 6 packages are looking for funding
3:44:46 PM: run npm fund for details
3:44:46 PM: found 0 vulnerabilities
3:44:46 PM: npm packages installed
3:44:46 PM: Started restoring cached go cache
3:44:46 PM: Finished restoring cached go cache
3:44:46 PM: go version go1.19.5 linux/amd64
3:44:47 PM: Detected 1 framework(s)
3:44:47 PM: “vite” at version “3.2.2”
3:44:47 PM: Installing missing commands
3:44:47 PM: Verify run directory
3:44:47 PM: Section completed: initializing
3:44:48 PM: ​
3:44:48 PM: Netlify Build
3:44:48 PM: ────────────────────────────────────────────────────────────────
3:44:48 PM: ​
3:44:48 PM: ❯ Version
3:44:48 PM: @netlify/build 29.5.1
3:44:48 PM: ​
3:44:48 PM: ❯ Flags
3:44:48 PM: baseRelDir: true
3:44:48 PM: buildId: 63cfeed1d9307c000950732f
3:44:48 PM: deployId: 63cfeed1d9307c0009507331
3:44:48 PM: ​
3:44:48 PM: ❯ Current directory
3:44:48 PM: /opt/build/repo
3:44:48 PM: ​
3:44:48 PM: ❯ Config file
3:44:48 PM: No config file was defined: using default values.
3:44:48 PM: ​
3:44:48 PM: ❯ Context
3:44:48 PM: production
3:44:48 PM: ​
3:44:48 PM: 1. Build command from Netlify app
3:44:48 PM: ────────────────────────────────────────────────────────────────
3:44:48 PM: ​
3:44:48 PM: $ npm run build
3:44:48 PM: > vanilla@0.0.0 build
3:44:48 PM: > vite build
3:44:49 PM: vite v3.2.2 building for production…
3:44:49 PM: transforming…
3:44:50 PM: ✓ 574 modules transformed.
3:44:50 PM: rendering chunks…
3:44:50 PM: dist/assets/mr_green.682e1e6e.svg 44.60 KiB
3:44:50 PM: dist/assets/clouds_pattern.5f62c503.svg 6.58 KiB
3:44:50 PM: dist/assets/index_background.6b18e721.png 1006.30 KiB
3:44:50 PM: dist/index.html 1.11 KiB
3:44:50 PM: Starting post processing
3:44:50 PM: dist/assets/index.8a541ff3.js 1.52 KiB / gzip: 0.66 KiB
3:44:50 PM: dist/assets/index.d463af70.css 1.71 KiB / gzip: 0.77 KiB
3:44:50 PM: ​
3:44:50 PM: Post processing - HTML
3:44:50 PM: (build.command completed in 1.9s)
3:44:50 PM: ​
3:44:50 PM: 2. Deploy site
3:44:51 PM: Post processing - header rules
3:44:50 PM: ────────────────────────────────────────────────────────────────
3:44:50 PM: ​
3:44:50 PM: Starting to deploy site from ‘dist’
3:44:51 PM: Post processing - redirect rules
3:44:50 PM: Calculating files to upload
3:44:50 PM: 0 new files to upload
3:44:50 PM: 0 new functions to upload
3:44:51 PM: Post processing done
3:44:50 PM: Section completed: deploying
3:44:50 PM: Site deploy was successfully initiated
3:44:50 PM: ​
3:44:51 PM: Section completed: postprocessing
3:44:50 PM: (Deploy site completed in 56ms)
3:44:50 PM: ​
3:44:50 PM: A “_redirects” file is present in the repository but is missing in the publish directory “dist”.
3:44:50 PM: ​
3:44:50 PM: Netlify Build Complete
3:44:50 PM: ────────────────────────────────────────────────────────────────
3:44:50 PM: ​
3:44:50 PM: (Netlify Build completed in 2s)
3:44:51 PM: Caching artifacts
3:44:51 PM: Started saving node modules
3:44:51 PM: Finished saving node modules
3:44:51 PM: Started saving build plugins
3:44:51 PM: Finished saving build plugins
3:44:51 PM: Site is live :sparkles:
3:44:51 PM: Started saving pip cache
3:44:51 PM: Finished saving pip cache
3:44:51 PM: Started saving emacs cask dependencies
3:44:51 PM: Finished saving emacs cask dependencies
3:44:51 PM: Started saving maven dependencies
3:44:51 PM: Finished saving maven dependencies
3:44:51 PM: Started saving boot dependencies
3:44:51 PM: Finished saving boot dependencies
3:44:51 PM: Started saving rust rustup cache
3:44:51 PM: Finished saving rust rustup cache
3:44:51 PM: Started saving go dependencies
3:44:51 PM: Finished saving go dependencies
3:44:51 PM: Build script success
3:44:51 PM: Section completed: building
3:44:51 PM: Uploading Cache of size 75.4MB
3:44:52 PM: Section completed: cleanup
3:44:52 PM: Finished processing build request in 11.982s

Thank you in advance!

@cyz This is because you aren’t deploying the root of your repository to Netlify (nor do you want to be).

Your project is being built with vite.

Your production log shows that your build command is npm run build:

3:44:48 PM: $ npm run build

Which in turn executes vite build

3:44:48 PM: > vite build

Without any configuration defining otherwise vite outputs to the dist folder, which your build log shows:

3:44:50 PM: rendering chunks…
3:44:50 PM: dist/assets/mr_green.682e1e6e.svg 44.60 KiB
3:44:50 PM: dist/assets/clouds_pattern.5f62c503.svg 6.58 KiB
3:44:50 PM: dist/assets/index_background.6b18e721.png 1006.30 KiB
3:44:50 PM: dist/index.html 1.11 KiB
3:44:50 PM: Starting post processing
3:44:50 PM: dist/assets/index.8a541ff3.js 1.52 KiB / gzip: 0.66 KiB
3:44:50 PM: dist/assets/index.d463af70.css 1.71 KiB / gzip: 0.77 KiB

You then appropriately have dist set as your publish folder:

3:44:50 PM: Starting to deploy site from ‘dist’

The /fetch.html file is never in the dist folder and thus does not get deployed.

It’s also why you see this in the build log.

3:44:50 PM: A “_redirects” file is present in the repository but is missing in the publish directory “dist”.

Anything that you want deployed should be moved into the dist folder which you can do pre/post build (depending on if your build wipes the entirety of the folder).

thank you for your reply, this was a VITE problem and this is the solution:

  1. Create a new file in the root called : vite.config.js
  2. add this in the js file:
import { defineConfig } from 'vite';
import { resolve } from 'path';
export default defineConfig({
    build: {
        outDir: 'dist',
        rollupOptions: {
            input: {
                main: resolve(__dirname, 'index.html'),
                fetch: resolve(__dirname, 'fetch.html'),
                key: resolve(__dirname, 'filename.html'),

            }
        }
    },
});

While you’ve resolved it by specifying the file as an additional input for your app, the problem was as described, the file simply wasn’t in your output.

Great work finding another way to get it in there.

Hi @nathanmartin thanks for helping @cyz get unstuck. (: