Build fails from GitHub (Page Not Found)

  • netlify site name: https://lovely-dragon-6dae26.netlify.app/
    *7635f63deb4beb249d857cc5c9c7eb78d4fd4316
    *Deploy log:

8:59:21 PM: build-image version: 7635f63deb4beb249d857cc5c9c7eb78d4fd4316 (focal)
8:59:21 PM: buildbot version: 7635f63deb4beb249d857cc5c9c7eb78d4fd4316
8:59:21 PM: Building without cache
8:59:21 PM: Starting to prepare the repo for build
8:59:22 PM: No cached dependencies found. Cloning fresh repo
8:59:22 PM: git clone --filter=blob:none https://github.com/Y-yPixel/Graduation-trip
8:59:22 PM: Preparing Git Reference refs/heads/main
8:59:23 PM: Parsing package.json dependencies
8:59:24 PM: Starting build script
8:59:24 PM: Installing dependencies
8:59:24 PM: Python version set to 2.7
8:59:24 PM: v16.19.0 is already installed.
8:59:24 PM: Now using node v16.19.0 (npm v8.19.3)
8:59:24 PM: Enabling Node.js Corepack
8:59:24 PM: Started restoring cached build plugins
8:59:24 PM: Finished restoring cached build plugins
8:59:25 PM: Attempting Ruby version 2.7.2, read from environment
8:59:25 PM: Using Ruby version 2.7.2
8:59:25 PM: Using PHP version 8.0
8:59:25 PM: Started restoring cached go cache
8:59:25 PM: Finished restoring cached go cache
8:59:25 PM: go version go1.19.5 linux/amd64
8:59:26 PM: Detected 0 framework(s)
8:59:26 PM: Installing missing commands
8:59:26 PM: Verify run directory
8:59:26 PM: Section completed: initializing
8:59:27 PM: ​
8:59:27 PM: Netlify Build
8:59:27 PM: ────────────────────────────────────────────────────────────────
8:59:27 PM: ​
8:59:27 PM: ❯ Version
8:59:27 PM: @netlify/build 29.5.1
8:59:27 PM: ​
8:59:27 PM: ❯ Flags
8:59:27 PM: baseRelDir: true
8:59:27 PM: buildId: 63da541875e51c0c2d8249de
8:59:27 PM: deployId: 63da541875e51c0c2d8249e0
8:59:27 PM: ​
8:59:27 PM: ❯ Current directory
8:59:27 PM: /opt/build/repo
8:59:27 PM: ​
8:59:27 PM: ❯ Config file
8:59:27 PM: No config file was defined: using default values.
8:59:27 PM: ​
8:59:27 PM: ❯ Context
8:59:27 PM: production
8:59:27 PM: ​
8:59:27 PM: 1. Build command from Netlify app
8:59:27 PM: ────────────────────────────────────────────────────────────────
8:59:27 PM: ​
8:59:27 PM: $ CI=β€˜β€™ npm run build
8:59:27 PM: npm ERR! code ENOENT
8:59:27 PM: npm ERR! syscall open
8:59:27 PM: npm ERR! path /opt/build/repo/package.json
8:59:27 PM: npm ERR! errno -2
8:59:27 PM: npm ERR! enoent ENOENT: no such file or directory, open β€˜/opt/build/repo/package.json’
8:59:27 PM: npm ERR! enoent This is related to npm not being able to find a file.
8:59:27 PM: npm ERR! enoent
8:59:27 PM: npm ERR! A complete log of this run can be found in:
8:59:27 PM: npm ERR! /opt/buildhome/.npm/_logs/2023-02-01T11_59_27_892Z-debug-0.log
8:59:27 PM: ​
8:59:27 PM: β€œbuild.command” failed
8:59:27 PM: ────────────────────────────────────────────────────────────────
8:59:27 PM: ​
8:59:29 PM: Failed during stage β€˜building site’: Build script returned non-zero exit code: 2 (Search results for '"non-zero exit code: 2"' - Netlify Support Forums)
8:59:27 PM: Error message
8:59:27 PM: Command failed with exit code 254: CI=β€˜β€™ npm run build (Search results for '"non-zero exit code: 254"' - Netlify Support Forums)
8:59:27 PM: ​
8:59:27 PM: Error location
8:59:27 PM: In Build command from Netlify app:
8:59:27 PM: CI=β€˜β€™ npm run build
8:59:27 PM: ​
8:59:27 PM: Resolved config
8:59:27 PM: build:
8:59:27 PM: command: CI=β€˜β€™ npm run build
8:59:27 PM: commandOrigin: ui
8:59:27 PM: publish: /opt/build/repo/dist/Graduation-trip
8:59:27 PM: publishOrigin: ui
8:59:28 PM: Caching artifacts
8:59:28 PM: Started saving build plugins
8:59:28 PM: Finished saving build plugins
8:59:28 PM: Started saving pip cache
8:59:28 PM: Finished saving pip cache
8:59:28 PM: Started saving emacs cask dependencies
8:59:28 PM: Finished saving emacs cask dependencies
8:59:28 PM: Started saving maven dependencies
8:59:28 PM: Finished saving maven dependencies
8:59:28 PM: Started saving boot dependencies
8:59:28 PM: Finished saving boot dependencies
8:59:28 PM: Started saving rust rustup cache
8:59:28 PM: Finished saving rust rustup cache
8:59:28 PM: Started saving go dependencies
8:59:28 PM: Finished saving go dependencies
8:59:28 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
8:59:28 PM: Failing build: Failed to build site
8:59:29 PM: Finished processing build request in 7.504s

I’m a beginner, so I don’t know how to set the build settings.
Uploading: Screenshot_20230201-212852.jpg…
Uploading: Screenshot_20230201-213339.jpg…

Hi @Y-yPixel :wave:t6: ,

Welcome to the forums and thanks so much for reaching out. When you say it fails from Github what do you mean? Does your build work locally?

I think this support guide might help! [Support Guide] I’ve deployed my site but I still see "Page not found”

1 Like

Thanks for the reply. But I have solved this problem!

Apparently, it seems that the cause was that the file name was not named β€œindex.html”. (I used β€œmain.html”.)
I changed it to β€œindex.html” and it worked!

(I’m Japanese, so I’m sorry if my English is wrong.)

@Y-yPixel Great work self-solving!

1 Like

yay! :blush: great work solving and thanks so much for sharing your solution with the community, and don’t worry you’re english is great! (:

1 Like