No repository files added to deploy preview with `netlify deploy` - "Page Not Found"

Hi!
After I run command netlify deploy everything succeded in logs. But when I enter “live URL” I receive “Page Not Found”. I’ve checked that the files are not uploaded to the build preview. There is only netlify.toml file. netlify dev works correctly. I’ve checked the project set up with netlify status and everything looks ok.
I was using netlify cli before with no problems, but two things happen when it stops working and I am not sure which could cause it.
First, I am using a new netlify project but with the same repository. But I’ve checked that I have the correct project selected in netlify status. And I didn’t change netlify.toml since it works with first project. It contains simple build config:

[build]
  Command = "npm run build"
  Functions = "lambda"
  Publish = "public"

Second, I made an update of netlify-cli.
Thanks for help.

hi there, did you see this guide already?

give that a read through and see if it fixes things. If not, please include a link to your life site so we can take a look.

1 Like

This is exactly what I did. I download deploy files, and there is only netlify.toml. The netlify status returns correct site details.
This is live url that doesn’t work: https://5e4bd3f354fc582fe8308979--modemaison-dev.netlify.com/
I have no idea what I could miss. Thanks for checking it.

Hi, @patrycja, and welcome to our Netlify community site.

The deploy linked to appears to be a manual deploy. What was the command used to deploy at that time?

I’m also seeing more recent deploys using a Git repo and our build system and those deploys are successful. Did you resolve the issue by using Git repo backed builds?

I used netlify deploy command. I would prefer to use netlify deploy instead git repo webhooks. Netlify CLI is better for me to test netlify functions. But while it doesn’t work, I use git builds, which works.

I’m showing the deploy linked to only has a single file in it: netlify.toml.

My best guess is that a different directory needs to be published with Netlify CLI. Would you please confirm the following is all true?

  • locally, the repo is cloned or update
  • npm install (or yarn install) is run
  • then something like npm run build is used to build the site
  • then you run the netlify deploy command to upload the build site files to Netlify

If this is the case, it sounds like the netlify deploy command used might need to be modified to specify a different directory to upload.

Would you please tell us where the command was run in the site directory tree, what command was used, and what directory the files to deploy are in?

This looks like a Gatsby build so I think the correct comment to deploy (a production deploy) using something similar to this:

netlify deploy --prod -d=public

This would be run from the base directory of the repo in most cases.

Would you please test the command above and let us know if that manual deploy works?

1 Like

Adding -d=public to the command fixed the problem. But I don’t know if it’s ok, that my .netlify/build folder is empty. I’ve checked that before deploy path was taken from this folder.
And another question, shouldn’t netlify.toml assign build directory? I have “public” directory used. I sent the content of my netlify.toml in the main post.

I looks like you’ve capitalized the keys in your neltify.toml file. Can you changing them to look like the following?

[build]
  command = "npm run build"
  functions = "lambda"
  publish = "public"

Let me know how it goes.

1 Like

It helped. But before the update of netlify-cli package it worked with capitalized.

glad it’s working now!