Page not found in netlify but works in localhost

PLEASE help us help you by writing a good post!

  • Netlify site name: enbiente.netlify.app
  • No dns issues
  • Build problems? No
  • I tried the netlify.toml and _redirects files, but nothing works

I used this template from horizon ui (GitHub - horizon-ui/horizon-ui-chakra: Horizon UI JavaScript ⭐️ The trendiest & innovative Open Source Admin Template for Chakra UI & React!) and modified it to make my project. It uses dynamic routes, I think. Works well on localhost but not on netlify. I dont know what to do, im a noob :confused:
The only way to deploy is using “CI= npm run build”, if i only use “npm run build”, it doesnt deploy.
github link: https://github.com/JDSB05/Enbiente it´s the Front-end/enbiente folder

Hey there @JDSB

It looks like that repo is using create-react-app. I’d recommend checking out any build and deploy logs in the UI to see where the problem might be. I have a feeling it’s trying to deploy the wrong directory since there isn’t a toml file telling Netlify what to publish.

I’d also recommend reading over this doc about deploying a CRA app. Make sure you’ve got the CLI installed and use that to initialize the Netlify config.
Once you’ve done that, see if you can build/deploy without the CI= bit in your build command. It shouldn’t be needed once the config is initialized properly.

Cheers!

There seems to be a bit of confusion in this thread concerning CI= at the start of the Build command.

This is to be expected if your build is throwing warnings.

By default CI is set to true.
When it is true warnings are treated as errors, and errors cause your build to fail.

Having CI= sets the CI environment variable to false, and allows your build to complete successfully even when it is throwing warnings that you don’t intend to fix.

It is mentioned as a reserved environment variable here:
https://docs.netlify.com/configure-builds/environment-variables/#netlify-configuration-variables

The behavior is explained in more detail here:
https://docs.netlify.com/configure-builds/troubleshooting-tips/#build-fails-on-warning-message


This doesn’t seem correct.
It remains necessary as long as the build is throwing warnings that the developer wants to ignore.


Regarding the “Page not found” issue, what do you have for your Build configuration?

https://docs.netlify.com/configure-builds/overview/#build-settings

In my build configuration i have this

Hi @JDSB,

Visiting enbiente.netlify.app and I see the following:

Could you let us know if you’re still having issues. I wasn’t able to replicate a Page Not Found error.

Hello! I forgot to close the thread, i managed to resolve the issue. My publish directory was wrong (it wasnt on build directory), thats why it didnt work even with the correct _redirect/netlify.toml file. Sorry for that!