Build failure - eleventy built GitHub-->Netlify ( custom domain )

Hi - I’ve just updated a site I look after for a local village hall (https://flaxbourtonhub.org) which uses a github repo that builds via 11ty/eleventy and got the following build failure. ( it built ok the first time )

The github is here https://github.com/drmarkoconnor/fbh

The package.json file is;

{
“name”: “simple-template”,
“version”: “1.0.0”,
“description”: “”,
“main”: “index.js”,
“dependencies”: {
@11ty/eleventy”: “0.12.1”
},
“keywords”: ,
“author”: “”,
“license”: “ISC”
}

The deploy log is below - I’m an html.css.js hobbyist at the edge of my abilities with understanding what is actually happening with builds/dependencies and so forth - so de-tech any answers would be great - much obliged as we want to open this community facility soon post lockdown - many thansk

Deploy Log for Netlify App
3:39:25 PM: Build ready to start
3:39:27 PM: build-image version: be42e453d6c8f171cc2f654acc29c0a8b60e6d93
3:39:27 PM: build-image tag: v3.7.1
3:39:27 PM: buildbot version: 746e1678cac5f8b3f4105502207986ec93202557
3:39:27 PM: Fetching cached dependencies
3:39:27 PM: Starting to download cache of 99.2MB
3:39:28 PM: Finished downloading cache in 685.388422ms
3:39:28 PM: Starting to extract cache
3:39:32 PM: Finished extracting cache in 3.765918372s
3:39:32 PM: Finished fetching cache in 4.494645813s
3:39:32 PM: Starting to prepare the repo for build
3:39:32 PM: Preparing Git Reference refs/heads/main
3:39:33 PM: Parsing package.json dependencies
3:39:34 PM: Starting build script
3:39:34 PM: Installing dependencies
3:39:34 PM: Python version set to 2.7
3:39:35 PM: Started restoring cached node version
3:39:38 PM: Finished restoring cached node version
3:39:39 PM: v12.18.0 is already installed.
3:39:39 PM: Now using node v12.18.0 (npm v6.14.4)
3:39:40 PM: Started restoring cached build plugins
3:39:40 PM: Finished restoring cached build plugins
3:39:40 PM: Attempting ruby version 2.7.1, read from environment
3:39:41 PM: Using ruby version 2.7.1
3:39:42 PM: Using PHP version 5.6
3:39:42 PM: Started restoring cached node modules
3:39:42 PM: Finished restoring cached node modules
3:39:42 PM: Started restoring cached go cache
3:39:42 PM: Finished restoring cached go cache
3:39:42 PM: go version go1.14.4 linux/amd64
3:39:42 PM: go version go1.14.4 linux/amd64
3:39:42 PM: Installing missing commands
3:39:42 PM: Verify run directory
3:39:44 PM: ​
3:39:44 PM: ────────────────────────────────────────────────────────────────
3:39:44 PM: Netlify Build
3:39:44 PM: ────────────────────────────────────────────────────────────────
3:39:44 PM: ​
3:39:44 PM: ❯ Version
3:39:44 PM: @netlify/build 9.17.1
3:39:44 PM: ​
3:39:44 PM: ❯ Flags
3:39:44 PM: apiHost: api.netlify.com
3:39:44 PM: cacheDir: /opt/build/cache
3:39:44 PM: deployId: 6060951db37d2aa221cd8953
3:39:44 PM: mode: buildbot
3:39:44 PM: testOpts:
3:39:44 PM: silentLingeringProcesses: ‘’
3:39:44 PM: ​
3:39:44 PM: ❯ Current directory
3:39:44 PM: /opt/build/repo
3:39:44 PM: ​
3:39:44 PM: ❯ Config file
3:39:44 PM: No config file was defined: using default values.
3:39:44 PM: ​
3:39:44 PM: ❯ Context
3:39:44 PM: production
3:39:44 PM: ​
3:39:44 PM: ────────────────────────────────────────────────────────────────
3:39:44 PM: 1. Build command from Netlify app
3:39:44 PM: ────────────────────────────────────────────────────────────────
3:39:44 PM: ​
3:39:44 PM: $ eleventy
3:39:47 PM: Problem writing Eleventy templates: (more in DEBUG output)
3:39:47 PM: > Having trouble rendering liquid (and markdown) template ./node_modules/liquidjs/README.md
3:39:47 PM: TemplateContentRenderError was thrown
3:39:47 PM: > Having trouble compiling template ./node_modules/liquidjs/README.md
3:39:47 PM: TemplateContentCompileError was thrown
3:39:47 PM: > illegal tag syntax, file:./node_modules/liquidjs/README.md, line:191
3:39:47 PM: TokenizationError was thrown:
3:39:47 PM: 189| Otherwise, undefined variables will cause an exception. Defaults to false.
3:39:47 PM: 190|
3:39:47 PM: >> 191| * trim_tag_right is used to strip blank characters (including , \t, and \r) from the right of tags ({% %}) until \n (inclusive). Defaults to false.
3:39:47 PM: 192|
3:39:47 PM: 193| * trim_tag_left is similiar to trim_tag_right, whereas the \n is exclusive. Defaults to false. See [Whitespace Control][whitespace control] for details.
3:39:47 PM: 194|
3:39:47 PM: TokenizationError: illegal tag syntax, file:./node_modules/liquidjs/README.md, line:191
3:39:47 PM: at parseTagToken (/opt/build/repo/node_modules/liquidjs/dist/liquid.common.js:1460:13)
3:39:47 PM: at parse (/opt/build/repo/node_modules/liquidjs/dist/liquid.common.js:1438:28)
3:39:47 PM: at Object.parse$$1 [as parse] (/opt/build/repo/node_modules/liquidjs/dist/liquid.common.js:3419:18)
3:39:47 PM: at Liquid.compile (/opt/build/repo/node_modules/@11ty/eleventy/src/Engines/Liquid.js:199:29)
3:39:47 PM: at Markdown.compile (/opt/build/repo/node_modules/@11ty/eleventy/src/Engines/Markdown.js:63:25)
3:39:47 PM: at TemplateRender.getCompiledTemplate (/opt/build/repo/node_modules/@11ty/eleventy/src/TemplateRender.js:199:26)
3:39:47 PM: at Template.compile (/opt/build/repo/node_modules/@11ty/eleventy/src/TemplateContent.js:181:42)
3:39:47 PM: at async Template.render (/opt/build/repo/node_modules/@11ty/eleventy/src/TemplateContent.js:196:16)
3:39:47 PM: at async Template._getContent (/opt/build/repo/node_modules/@11ty/eleventy/src/Template.js:547:12)
3:39:47 PM: at async Template.getTemplateMapContent (/opt/build/repo/node_modules/@11ty/eleventy/src/Template.js:732:19)
3:39:47 PM: Wrote 0 files in 2.63 seconds (v0.12.1)
3:39:48 PM: ​
3:39:48 PM: ────────────────────────────────────────────────────────────────
3:39:48 PM: “build.command” failed
3:39:48 PM: ────────────────────────────────────────────────────────────────
3:39:48 PM: ​
3:39:48 PM: Error message
3:39:48 PM: Command failed with exit code 1: eleventy
3:39:48 PM: ​
3:39:48 PM: Error location
3:39:48 PM: In Build command from Netlify app:
3:39:48 PM: eleventy
3:39:48 PM: ​
3:39:48 PM: Resolved config
3:39:48 PM: build:
3:39:48 PM: command: eleventy
3:39:48 PM: commandOrigin: ui
3:39:48 PM: publish: /opt/build/repo/_site
3:39:48 PM: Caching artifacts
3:39:48 PM: Started saving node modules
3:39:48 PM: Finished saving node modules
3:39:48 PM: Started saving build plugins
3:39:48 PM: Finished saving build plugins
3:39:48 PM: Started saving pip cache
3:39:48 PM: Finished saving pip cache
3:39:48 PM: Started saving emacs cask dependencies
3:39:48 PM: Finished saving emacs cask dependencies
3:39:48 PM: Started saving maven dependencies
3:39:48 PM: Finished saving maven dependencies
3:39:48 PM: Started saving boot dependencies
3:39:48 PM: Finished saving boot dependencies
3:39:48 PM: Started saving rust rustup cache
3:39:48 PM: Finished saving rust rustup cache
3:39:48 PM: Started saving go dependencies
3:39:48 PM: Finished saving go dependencies
3:39:48 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
3:39:48 PM: Failing build: Failed to build site
3:39:48 PM: Failed during stage ‘building site’: Build script returned non-zero exit code: 2
3:39:48 PM: Finished processing build request in 21.198054276s

For some reason, your code is trying to compile Markdown files from Node Modules. If you share your repo, maybe we can provide a more educated guess.

Thanks - no idea why that might be the case??

Here is the repo

Very grateful for your response

I just made a slight change to your repo and it’s working fine: GitHub - Hrishikesh-K/fbh-main

The change: In your package.json, I added:

  "scripts": {
    "build": "eleventy"
  }

And thus, I used the build command: npm run build. This works fine: https://wonderful-brahmagupta-a090b0.netlify.app/

Many thanks but I adjusted the package.json file as you had suggested but I am still getting build fail with the following - where is that README file coming from that throws the error?

I was heartened to see the site changes on your netlify but stumped as to why I can’t repeat it with the same repo??

many thanks

6:36:15 PM: $ eleventy
6:36:17 PM: Problem writing Eleventy templates: (more in DEBUG output)
6:36:17 PM: > Having trouble rendering liquid (and markdown) template ./node_modules/liquidjs/README.md
6:36:17 PM: TemplateContentRenderError was thrown
6:36:17 PM: > Having trouble compiling template ./node_modules/liquidjs/README.md
6:36:17 PM: TemplateContentCompileError was thrown
6:36:17 PM: > illegal tag syntax, file:./node_modules/liquidjs/README.md, line:191
6:36:17 PM: TokenizationError was thrown:
6:36:17 PM: 189| Otherwise, undefined variables will cause an exception. Defaults to false.
6:36:17 PM: 190|
6:36:17 PM: >> 191| * trim_tag_right is used to strip blank characters (including , \t, and \r) from the right of tags ({% %}) until \n (inclusive). Defaults to false.
6:36:17 PM: 192|
6:36:17 PM: 193| * trim_tag_left is similiar to trim_tag_right, whereas the \n is exclusive. Defaults to false. See [Whitespace Control][whitespace control] for details.
6:36:17 PM: 194|
6:36:17 PM: TokenizationError: illegal tag syntax, file:./node_modules/liquidjs/README.md, line:191
6:36:17 PM: at parseTagToken (/opt/build/repo/node_modules/liquidjs/dist/liquid.common.js:1460:13)
6:36:17 PM: at parse (/opt/build/repo/node_modules/liquidjs/dist/liquid.common.js:1438:28)
6:36:17 PM: at Object.parse$$1 [as parse] (/opt/build/repo/node_modules/liquidjs/dist/liquid.common.js:3419:18)
6:36:17 PM: at Liquid.compile (/opt/build/repo/node_modules/@11ty/eleventy/src/Engines/Liquid.js:199:29)
6:36:17 PM: at Markdown.compile (/opt/build/repo/node_modules/@11ty/eleventy/src/Engines/Markdown.js:63:25)
6:36:17 PM: at TemplateRender.getCompiledTemplate (/opt/build/repo/node_modules/@11ty/eleventy/src/TemplateRender.js:199:26)
6:36:17 PM: at Template.compile (/opt/build/repo/node_modules/@11ty/eleventy/src/TemplateContent.js:181:42)
6:36:17 PM: at async Template.render (/opt/build/repo/node_modules/@11ty/eleventy/src/TemplateContent.js:196:16)
6:36:17 PM: at async Template._getContent (/opt/build/repo/node_modules/@11ty/eleventy/src/Template.js:547:12)
6:36:17 PM: at async Template.getTemplateMapContent (/opt/build/repo/node_modules/@11ty/eleventy/src/Template.js:732:19)
6:36:17 PM: Wrote 0 files in 1.95 seconds (v0.12.1)
6:36:17 PM: ​
6:36:17 PM: ────────────────────────────────────────────────────────────────
6:36:17 PM: “build.command” failed
6:36:17 PM: ────────────────────────────────────────────────────────────────
6:36:17 PM: ​
6:36:17 PM: Error message
6:36:17 PM: Command failed with exit code 1: eleventy
6:36:17 PM: ​
6:36:17 PM: Error location
6:36:17 PM: In Build command from Netlify app:
6:36:17 PM: eleventy
6:36:17 PM: ​
6:36:17 PM: Resolved config
6:36:17 PM: build:
6:36:17 PM: command: eleventy
6:36:17 PM: commandOrigin: ui
6:36:17 PM: publish: /opt/build/repo/_site
6:36:17 PM: Caching artifacts
6:36:17 PM: Started saving node modules
6:36:17 PM: Finished saving node modules
6:36:17 PM: Started saving build plugins
6:36:17 PM: Finished saving build plugins
6:36:17 PM: Started saving pip cache
6:36:18 PM: Finished saving pip cache
6:36:18 PM: Started saving emacs cask dependencies
6:36:18 PM: Finished saving emacs cask dependencies
6:36:18 PM: Started saving maven dependencies
6:36:18 PM: Finished saving maven dependencies
6:36:18 PM: Started saving boot dependencies
6:36:18 PM: Finished saving boot dependencies
6:36:18 PM: Started saving rust rustup cache
6:36:18 PM: Finished saving rust rustup cache
6:36:18 PM: Started saving go dependencies
6:36:18 PM: Finished saving go dependencies
6:36:20 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
6:36:20 PM: Failed during stage ‘building site’: Build script returned non-zero exit code: 2
6:36:20 PM: Failing build: Failed to build site
6:36:21 PM: Finished processing build request in 27.540474295s

As I can see, you’re still running eleventy as the command. Does changing it to npm run build make any difference?

Just tried that and failed with

PM: ────────────────────────────────────────────────────────────────
6:42:07 PM: 1. Build command from Netlify app
6:42:07 PM: ────────────────────────────────────────────────────────────────
6:42:07 PM: ​
6:42:07 PM: $ npm run build
6:42:07 PM: > simple-template@1.0.0 build /opt/build/repo
6:42:07 PM: > eleventy
6:42:10 PM: Problem writing Eleventy templates: (more in DEBUG output)
6:42:10 PM: > Having trouble rendering liquid (and markdown) template ./node_modules/liquidjs/README.md
6:42:10 PM: TemplateContentRenderError was thrown
6:42:10 PM: > Having trouble compiling template ./node_modules/liquidjs/README.md
6:42:10 PM: TemplateContentCompileError was thrown
6:42:10 PM: > illegal tag syntax, file:./node_modules/liquidjs/README.md, line:191
6:42:10 PM: TokenizationError was thrown:

To confirm, have you the relevant template format in your .eleventy.js?

It should look something like this:

return {
    templateFormats: ["md", "njk", "html", "liquid"],

    // If your site lives in a different subdirectory, change this.
    // Leading or trailing slashes are all normalized away, so don’t worry about it.
    // If you don’t have a subdirectory, use "" or "/" (they do the same thing)
    // This is only used for URLs (it does not affect your file structure)
    pathPrefix: "/",

    markdownTemplateEngine: "liquid",
    htmlTemplateEngine: "liquid",
    dataTemplateEngine: "liquid",
    dir: {
      input: ".",
      includes: "_includes",
      data: "_data",
      output: "_site"
    }
  };

2 things to try:

  1. Probably easier and might work: Use my repo as is and try if that works.
  2. Try adding node_modules (and _site)to your.gitignore`. Hopefully, that will cause Elevety to ignore that folder during build.
1 Like

If you want Eleventy to ignore a directory/file, you can use an .eleventyignore file.

For example, my projects usually have these in it since they are typically the culprits :slightly_smiling_face: :

README.md
.github/
node_modules

Hurrah! - It was the .gitignore file - I deleted it and all is well - there is a thread here which helped .gitignore causes "AssertionError: tag ab not found" · Issue #1193 · 11ty/eleventy · GitHub

Once again many thanks for your help it is greatly appreciated

Best Wishes

Mark

2 Likes

Great tip thanks - appreciate the help

2 Likes