Website deploy not working

Hello people.
I’ve tried to upload a website to netlify but it didn’t work for me.

  1. I’ve tried connecting to github and all went fine. When I’ve tried to access the website after deploy, I keep getting Page Not Found error. After doing some research, I saw that this is a common error if you use react-router because it cannot detect index.html correctly.
    I’ve tried here the solution with adding the _redirects file + the content but it didn’t work for me.

  2. I’ve tried manually uploading the build folder but it seems that it’s stuck or something because it’s already 25 minutes and still loading.

Useful info:
→ i’ve used CRA to create the website
Netlify App → manual build not uploading
Netlify App → github connection giving Page not found

Hi @nandramihnea , welcome to the community :wave:

Can you confirm you’re defining the correct publish directory for your framework? Framework integrations | Netlify Docs You can define them in the UI or in your netlify.tonl.

Hope this helps and keep us posted!

Hey @audrey.
Thanks for your quick response.
I’ve looked over my build settings and yes, you we’re right, I was not specifying any build command/directory.
After doing that, and some time spent to search on the forum for the same issue, I still couldn’t repair the build. Apparently it’s something about package.json not being found in the build directory or something related. Here is a copy of the log.

8:40:41 PM: Build ready to start
8:41:04 PM: build-image version: 0e2f4c52031ab562db66aec633308326e3b108d0 (focal)
8:41:04 PM: build-image tag: focal
8:41:04 PM: buildbot version: 0d1cf41e4e345a224c39ab2a783aa4af5c76f6e8
8:41:04 PM: Building without cache
8:41:04 PM: Starting to prepare the repo for build
8:41:04 PM: No cached dependencies found. Cloning fresh repo
8:41:04 PM: git clone https://github.com/nandramihnea/CATZZZ
8:41:05 PM: Preparing Git Reference refs/heads/main
8:41:05 PM: Parsing package.json dependencies
8:41:06 PM: Starting build script
8:41:06 PM: Installing dependencies
8:41:06 PM: Python version set to 2.7
8:41:07 PM: Downloading and installing node v16.16.0…
8:41:07 PM: Downloading https://nodejs.org/dist/v16.16.0/node-v16.16.0-linux-x64.tar.xz
8:41:07 PM: Computing checksum with sha256sum
8:41:07 PM: Checksums matched!
8:41:10 PM: Now using node v16.16.0 (npm v8.11.0)
8:41:10 PM: Started restoring cached build plugins
8:41:10 PM: Finished restoring cached build plugins
8:41:10 PM: Attempting ruby version 2.7.2, read from environment
8:41:11 PM: Using ruby version 2.7.2
8:41:12 PM: Using PHP version 8.0
8:41:12 PM: Started restoring cached go cache
8:41:12 PM: Finished restoring cached go cache
8:41:12 PM: Installing Go version 1.17 (requested 1.17)
8:41:17 PM: unset GOOS;
8:41:17 PM: unset GOARCH;
8:41:17 PM: export GOROOT=‘/opt/buildhome/.gimme/versions/go1.17.linux.amd64’;
8:41:17 PM: export PATH=“/opt/buildhome/.gimme/versions/go1.17.linux.amd64/bin:${PATH}”;
8:41:17 PM: go version >&2;
8:41:17 PM: export GIMME_ENV=“/opt/buildhome/.gimme/env/go1.17.linux.amd64.env”
8:41:17 PM: go version go1.17 linux/amd64
8:41:17 PM: Installing missing commands
8:41:17 PM: Verify run directory
8:41:18 PM: ​
8:41:18 PM: ────────────────────────────────────────────────────────────────
8:41:18 PM: Netlify Build
8:41:18 PM: ────────────────────────────────────────────────────────────────
8:41:18 PM: ​
8:41:18 PM: ❯ Version
8:41:18 PM: @netlify/build 27.3.4
8:41:18 PM: ​
8:41:18 PM: ❯ Flags
8:41:18 PM: baseRelDir: true
8:41:18 PM: buildId: 62d457a9200b4b06b363ff6f
8:41:18 PM: deployId: 62d457a9200b4b06b363ff71
8:41:18 PM: ​
8:41:18 PM: ❯ Current directory
8:41:18 PM: /opt/build/repo
8:41:18 PM: ​
8:41:18 PM: ❯ Config file
8:41:18 PM: No config file was defined: using default values.
8:41:18 PM: ​
8:41:18 PM: ❯ Context
8:41:18 PM: production
8:41:18 PM: ​
8:41:18 PM: ────────────────────────────────────────────────────────────────
8:41:18 PM: 1. Build command from Netlify app
8:41:18 PM: ────────────────────────────────────────────────────────────────
8:41:18 PM: ​
8:41:18 PM: $ npm run build
8:41:19 PM: npm ERR! code ENOENT
8:41:19 PM: npm ERR! syscall open
8:41:19 PM: npm ERR! path /opt/build/repo/package.json
8:41:19 PM: npm ERR! errno -2
8:41:19 PM: npm ERR! enoent ENOENT: no such file or directory, open ‘/opt/build/repo/package.json’
8:41:19 PM: npm ERR! enoent This is related to npm not being able to find a file.
8:41:19 PM: npm ERR! enoent
8:41:19 PM: npm ERR! A complete log of this run can be found in:
8:41:19 PM: npm ERR! /opt/buildhome/.npm/_logs/2022-07-17T18_41_19_098Z-debug-0.log
8:41:19 PM: ​
8:41:19 PM: ────────────────────────────────────────────────────────────────
8:41:19 PM: “build.command” failed
8:41:19 PM: ────────────────────────────────────────────────────────────────
8:41:19 PM: ​
8:41:19 PM: Error message
8:41:19 PM: Command failed with exit code 254: npm run build (Search results for '"non-zero exit code: 254"' - Netlify Support Forums)
8:41:19 PM: ​
8:41:19 PM: Error location
8:41:19 PM: In Build command from Netlify app:
8:41:19 PM: npm run build
8:41:19 PM: ​
8:41:19 PM: Resolved config
8:41:19 PM: build:
8:41:19 PM: command: npm run build
8:41:19 PM: commandOrigin: ui
8:41:19 PM: publish: /opt/build/repo/build
8:41:19 PM: publishOrigin: ui
8:41:19 PM: Caching artifacts
8:41:19 PM: Started saving build plugins
8:41:19 PM: Finished saving build plugins
8:41:19 PM: Started saving pip cache
8:41:19 PM: Finished saving pip cache
8:41:19 PM: Started saving emacs cask dependencies
8:41:19 PM: Finished saving emacs cask dependencies
8:41:19 PM: Started saving maven dependencies
8:41:19 PM: Finished saving maven dependencies
8:41:19 PM: Started saving boot dependencies
8:41:19 PM: Finished saving boot dependencies
8:41:19 PM: Started saving rust rustup cache
8:41:19 PM: Finished saving rust rustup cache
8:41:19 PM: Started saving go dependencies
8:41:19 PM: Finished saving go dependencies
8:41:21 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
8:41:21 PM: Creating deploy upload records
8:41:21 PM: Failing build: Failed to build site
8:41:21 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:41:21 PM: Finished processing build request in 17.155909898s

Hi @nandramihnea,

This response in a past post from @coelmay, may help you resolve the issue. Do you have a package.json within the root directory of the repository that you’re deploying?

1 Like

Hey Melvin.


Yes it’s inside the root folder.
Although, /build is the folder that I used for deploy.

Hey @nandramihnea , we see the package.json file in your screenshot, but can you confirm if you see the same file in your repo on GitHub?


Of course :slight_smile:

Hey @nandramihnea ,

Ah, looks like you’ll also need to set the base directory in the UI: Netlify App

Let us know how it goes!

it worked! I’ve changed the base directory and it did work, indeed!
THanks!