0

I'm getting a page not found error on my netlify react site after updating my code. It was working before the update and I'm not sure why it doesn't work now. All I updated was some CSS. No new files, dependencies, etc. I did the usual git add, git commit, git push and netlify did an automatic deploy since I connected my github repo. Only now it doesn't work.

Some more context: I am using heroku to host the server for my site. Netlify for the front end. To deploy to netlify, I cd'd into my client folder, ran 'npm run build' and then dragged and dropped the build file into netlify. Netlify worked it's magic and the site was working up until I pushed the changes.

I did some research on it and have tried several things like:

changing the build command to CI = npm run build

adding environmental variables "CI" as the key and "false" as the value

adding environmental variables "NPM_FLAGS" as the key and "--legacy-peer-deps" as the value (this is what I currently have in my settings"

and these have not worked. If I trigger a deploy I get:

11:01:50 PM: Build ready to start
11:02:12 PM: build-image version: d7b3dbfb0846505993c9a131894d1858074c90b4 (focal)
11:02:12 PM: build-image tag: v4.10.1
11:02:12 PM: buildbot version: 67e75f1ba713a8213d4b5a8ccf9708af751e2390
11:02:12 PM: Fetching cached dependencies
11:02:12 PM: Starting to download cache of 139.9MB
11:02:13 PM: Finished downloading cache in 1.234733545s
11:02:13 PM: Starting to extract cache
11:02:15 PM: Finished extracting cache in 1.886946674s
11:02:15 PM: Finished fetching cache in 3.184475756s
11:02:15 PM: Starting to prepare the repo for build
11:02:15 PM: Preparing Git Reference refs/heads/main
11:02:15 PM: Parsing package.json dependencies
11:02:16 PM: No build steps found, continuing to publishing
11:02:16 PM: Starting to deploy site from ''
11:02:16 PM: Creating deploy tree asynchronously
11:02:16 PM: Creating deploy upload records
11:02:18 PM: 1 new files to upload
11:02:18 PM: 0 new functions to upload
11:02:19 PM: Starting post processing
11:02:19 PM: Post processing - HTML
11:02:19 PM: Post processing - header rules
11:02:19 PM: Post processing - redirect rules
11:02:19 PM: Post processing done
11:02:20 PM: Uploading Cache of size 139.9MB
11:02:21 PM: Finished processing build request in 8.924801917s
11:02:22 PM: Site is live ✨

But the site still gives the Page Not Found error.

I think this might be because of my folder structure? My repo contains a client directory and a server directory. When I did the initial deploy I ran 'npm run build' in the client directory and deployed that. Maybe now that I pushed the code it is trying to build the whole repo and not just the client directory? If that might be the case, how I could I fix that issue?

Here is a link to the repo: https://github.com/vbrambila2/one-rep-max Here is a link to the netlify site: https://onerep.netlify.app/

Victor
  • 329
  • 4
  • 17

1 Answers1

0

The error is because you have pushed your .eny file to the repository.

The .env file should never be pushed to the GitHub repository.

Remove the file. And then revert back if your error is removed.

Shilpe Saxena
  • 219
  • 2
  • 8