Chicken and egg issue with a deployment

I built a one page Eleventy site with a Node script. My intent was that I’d deploy the site and my build command would run the script and then build Eleventy.

So my folder has 3 files: - just a markdown file
build.js - a simple script
netlify.tom - which is:

	publish = "_site/"
	command = "node build && npx @11ty/eleventy"

I then ran netlify deploy, but I get this error:

Error: No such directory /home/ray/projects/api-integration-jamstack/demos/demo4/_site! Did you forget to run a build?

But shouldn’t it have run the command when deployed which would then run Eleventy and create _site?

Hi, @cfjedimaster, the deploy command actually just deploys static files (and prepared functions). It expects that the build step has been run before the netlify delpoy command occurs.

There is a new command, netlify build, which is in beta currently:

$ netlify help build
(Beta) Build on your local machine

  $ netlify build

  --context=context                                            Build context
  --debug                                                      Print debugging information
  --dry                                                        Dry run: show instructions without running them
  --httpProxy=httpProxy                                        Proxy server address to route requests through.
  --httpProxyCertificateFilename=httpProxyCertificateFilename  Certificate file to use when connecting using a proxy server

  netlify build

So, running “netlify build && netlify deploy” would be the closest equivalent to the web UI “build & deploy” if that is what you are looking for.

​Please let us know if there are other questions and/or if this workaround doesn’t work for any reason.

Interesting. Ok, thanks for sharing that. Do yall keep a changelog of the CLI to keep up to date with changes?

hi there,

you can see the latest information on the CLI here: