Eleventy build command - is "npx @11ty/eleventy" correct?

So I got my site up and running pretty quickly, but it took me a little while to find a suitable build command for eleventy since it wasn’t listed on this page: https://docs.netlify.com/configure-builds/common-configurations/#javascript-spas

Clearly everything can’t be listed there, but it looks as though certain tools are configured out of the box, and are ready to go? I’ve not run one of those builds, so maybe they do use the whole caching mechanism for Node etc. (or for whatever’s required of them), but if that’s not the case and they are OOTB, is there a similar option for Eleventy or should I just stick with using: npx @11ty/eleventy for now? Only reason I ask is I want the moon on a stick, and < 1 second build time instead of a 1 minute build time :stuck_out_tongue:

Hi, welcome! Actually, I think Eleventy is configured out of the box. You can use eleventy or DEBUG=* eleventy (for more detailed logs) as a build command. If you want to set up a netlify.toml file it would look like this:

  publish = "_site"
  command = "DEBUG=* eleventy"

Just gave that a whirl, but it failed to build, and then I realised I didn’t have a package.json either because I’d been using a global install on my local machine. So sorted that out and the above worked - takes about the same time but at least it means it’s no longer dependent on UI settings!

1 Like

Hi. I’m trying to deploy my first attempt at a 11ty site to Netlify but my build command keeps bombing out with a 127 exit code, i think this is related to what you guys have described but i could do with a hand from someone with a bit more experience.

Error is : Command failed with exit code 127: eleventy

Build command is set to : eleventy

package.json contains:

“scripts”: {
“test”: “echo “Error: no test specified” && exit 1”,
“build”: “npx eleventy”,
“serve”: “npx eleventy --serve”,
“debug”: “DEBUG=* npx eleventy”

Also my publish dir is : publish: /opt/build/repo/_site
But i specified _site in the Build settings on Netlify.

Sorry for the newbie questions.

hi @fraserwaters,

if your build command is set to eleventy then you’d need a definition of that command and what it is supposed to do, but you don’t - you have build, serve, and debug.

You’d need to either change the build command you have defined in the UI, or change the command in your package json - they have to match :slight_smile:

This Support Guide contains a ton of useful debugging tips.