Deployment issue

I need advice to debug deploy https://app.netlify.com/sites/soarveyor/deploys/6005d6aa4a13530007291e6c

This deploy fails on Netlify but works fine on local

The deploy log is private.

hi there, something seems wrong with your file system:


10:43:09 AM: Writing _site/backgrounds.css from ./backgrounds.css.njk.
10:43:12 AM: Error writing templates: (more in DEBUG output)
10:43:12 AM: > Having trouble writing template: _site/portfolio/index.html
10:43:12 AM: `TemplateWriterWriteError` was thrown
10:43:12 AM: > (./_includes/layouts/base.njk)
10:43:12 AM:   Template render error: (/opt/build/repo/_includes/components/head.njk)
10:43:12 AM:   Error: template not found: backgrounds.css
10:43:12 AM: `Template render error` was thrown:
10:43:12 AM:     Template render error: (./_includes/layouts/base.njk)
10:43:12 AM:       Template render error: (/opt/build/repo/_includes/components/head.njk)
10:43:12 AM:       Error: template not found: backgrounds.css
10:43:12 AM:         at Object._prettifyError (/opt/build/repo/node_modules/nunjucks/src/lib.js:36:11)
10:43:12 AM:         at /opt/build/repo/node_modules/nunjucks/src/environment.js:561:19
10:43:12 AM:         at eval (eval at _compile (/opt/build/repo/node_modules/nunjucks/src/environment.js:631:18), <anonymous>:18:11)
10:43:12 AM:         at /opt/build/repo/node_modules/nunjucks/src/environment.js:569:11
10:43:12 AM:         at eval (eval at _compile (/opt/build/repo/node_modules/nunjucks/src/environment.js:631:18), <anonymous>:185:12)
10:43:12 AM:         at createTemplate (/opt/build/repo/node_modules/nunjucks/src/environment.js:293:11)
10:43:12 AM:         at next (/opt/build/repo/node_modules/nunjucks/src/lib.js:328:7)
10:43:12 AM:         at handle (/opt/build/repo/node_modules/nunjucks/src/environment.js:327:11)
10:43:12 AM:         at /opt/build/repo/node_modules/nunjucks/src/environment.js:337:9
10:43:12 AM:         at next (/opt/build/repo/node_modules/nunjucks/src/lib.js:326:7)
10:43:12 AM: Problem writing Eleventy templates: (more in DEBUG output)
10:43:12 AM: > Having trouble writing template: _site/portfolio/index.html
10:43:12 AM: `TemplateWriterWriteError` was thrown
10:43:12 AM: > (./_includes/layouts/base.njk)
10:43:12 AM:   Template render error: (/opt/build/repo/_includes/components/head.njk)
10:43:12 AM:   Error: template not found: backgrounds.css
10:43:12 AM: `Template render error` was thrown:
10:43:12 AM:     Template render error: (./_includes/layouts/base.njk)
10:43:12 AM:       Template render error: (/opt/build/repo/_includes/components/head.njk)
10:43:12 AM:       Error: template not found: backgrounds.css
10:43:12 AM:         at Object._prettifyError (/opt/build/repo/node_modules/nunjucks/src/lib.js:36:11)
10:43:12 AM:         at /opt/build/repo/node_modules/nunjucks/src/environment.js:561:19
10:43:12 AM:         at eval (eval at _compile (/opt/build/repo/node_modules/nunjucks/src/environment.js:631:18), <anonymous>:18:11)
10:43:12 AM:         at /opt/build/repo/node_modules/nunjucks/src/environment.js:569:11
10:43:12 AM:         at eval (eval at _compile (/opt/build/repo/node_modules/nunjucks/src/environment.js:631:18), <anonymous>:185:12)
10:43:12 AM:         at createTemplate (/opt/build/repo/node_modules/nunjucks/src/environment.js:293:11)
10:43:12 AM:         at next (/opt/build/repo/node_modules/nunjucks/src/lib.js:328:7)
10:43:12 AM:         at handle (/opt/build/repo/node_modules/nunjucks/src/environment.js:327:11)
10:43:12 AM:         at /opt/build/repo/node_modules/nunjucks/src/environment.js:337:9
10:43:12 AM:         at next (/opt/build/repo/node_modules/nunjucks/src/lib.js:326:7)
10:43:12 AM: Benchmark (Configuration): "cssmin" Nunjucks Filter took 3094ms (81.8%, called 9×, 343.7ms each)
10:43:12 AM: Copied 1 file / Wrote 0 files in 3.44 seconds (v0.11.1)

does this build locally?

Yea, it builds fine locally. That’s the strange part - locally it outputs the file just fine, in the right directory and it becomes the correct file extension as defined in the front matter.

How’s this @hrishikesh?

12:42:50 PM: Build ready to start
12:42:54 PM: build-image version: 53b83b6bede2920f236b25b6f5a95334320dc849
12:42:54 PM: build-image tag: v3.6.0
12:42:54 PM: buildbot version: 7d7f8cd4cc19a5205bae0ea8df58feec103fed05
12:42:54 PM: Fetching cached dependencies
12:42:54 PM: Starting to download cache of 95.6MB
12:42:55 PM: Finished downloading cache in 986.419624ms
12:42:55 PM: Starting to extract cache
12:42:58 PM: Finished extracting cache in 2.869133931s
12:42:58 PM: Finished fetching cache in 3.884188393s
12:42:58 PM: Starting to prepare the repo for build
12:42:59 PM: Preparing Git Reference refs/heads/master
12:43:00 PM: Starting build script
12:43:00 PM: Installing dependencies
12:43:00 PM: Python version set to 2.7
12:43:01 PM: Started restoring cached node version
12:43:03 PM: Finished restoring cached node version
12:43:04 PM: v12.18.0 is already installed.
12:43:04 PM: Now using node v12.18.0 (npm v6.14.4)
12:43:04 PM: Started restoring cached build plugins
12:43:04 PM: Finished restoring cached build plugins
12:43:05 PM: Attempting ruby version 2.7.1, read from environment
12:43:06 PM: Using ruby version 2.7.1
12:43:06 PM: Using PHP version 5.6
12:43:06 PM: Started restoring cached node modules
12:43:06 PM: Finished restoring cached node modules
12:43:06 PM: Started restoring cached go cache
12:43:06 PM: Finished restoring cached go cache
12:43:06 PM: go version go1.14.4 linux/amd64
12:43:06 PM: go version go1.14.4 linux/amd64
12:43:06 PM: Installing missing commands
12:43:06 PM: Verify run directory
12:43:08 PM: ​
12:43:08 PM: ────────────────────────────────────────────────────────────────
12:43:08 PM:   Netlify Build                                                 
12:43:08 PM: ────────────────────────────────────────────────────────────────
12:43:08 PM: ​
12:43:08 PM: ❯ Version
12:43:08 PM:   @netlify/build 8.0.5
12:43:08 PM: ​
12:43:08 PM: ❯ Flags
12:43:08 PM:   deployId: 6005d6aa4a13530007291e6c
12:43:08 PM:   mode: buildbot
12:43:08 PM: ​
12:43:08 PM: ❯ Current directory
12:43:08 PM:   /opt/build/repo
12:43:08 PM: ​
12:43:08 PM: ❯ Config file
12:43:08 PM:   No config file was defined: using default values.
12:43:08 PM: ​
12:43:08 PM: ❯ Context
12:43:08 PM:   production
12:43:08 PM: ​
12:43:08 PM: ────────────────────────────────────────────────────────────────
12:43:08 PM:   1. Build command from Netlify app                             
12:43:08 PM: ────────────────────────────────────────────────────────────────
12:43:08 PM: ​
12:43:08 PM: $ eleventy
12:43:09 PM: Writing _site/backgrounds.css from ./backgrounds.css.njk.
12:43:12 PM: Error writing templates: (more in DEBUG output)
12:43:12 PM: > Having trouble writing template: _site/portfolio/index.html
12:43:12 PM: `TemplateWriterWriteError` was thrown
12:43:12 PM: > (./_includes/layouts/base.njk)
12:43:12 PM:   Template render error: (/opt/build/repo/_includes/components/head.njk)
12:43:12 PM:   Error: template not found: backgrounds.css
12:43:12 PM: `Template render error` was thrown:
12:43:12 PM:     Template render error: (./_includes/layouts/base.njk)
12:43:12 PM:       Template render error: (/opt/build/repo/_includes/components/head.njk)
12:43:12 PM:       Error: template not found: backgrounds.css
12:43:12 PM:         at Object._prettifyError (/opt/build/repo/node_modules/nunjucks/src/lib.js:36:11)
12:43:12 PM:         at /opt/build/repo/node_modules/nunjucks/src/environment.js:561:19
12:43:12 PM:         at eval (eval at _compile (/opt/build/repo/node_modules/nunjucks/src/environment.js:631:18), <anonymous>:18:11)
12:43:12 PM:         at /opt/build/repo/node_modules/nunjucks/src/environment.js:569:11
12:43:12 PM:         at eval (eval at _compile (/opt/build/repo/node_modules/nunjucks/src/environment.js:631:18), <anonymous>:185:12)
12:43:12 PM:         at createTemplate (/opt/build/repo/node_modules/nunjucks/src/environment.js:293:11)
12:43:12 PM:         at next (/opt/build/repo/node_modules/nunjucks/src/lib.js:328:7)
12:43:12 PM:         at handle (/opt/build/repo/node_modules/nunjucks/src/environment.js:327:11)
12:43:12 PM:         at /opt/build/repo/node_modules/nunjucks/src/environment.js:337:9
12:43:12 PM:         at next (/opt/build/repo/node_modules/nunjucks/src/lib.js:326:7)
12:43:12 PM: Problem writing Eleventy templates: (more in DEBUG output)
12:43:12 PM: > Having trouble writing template: _site/portfolio/index.html
12:43:12 PM: `TemplateWriterWriteError` was thrown
12:43:12 PM: > (./_includes/layouts/base.njk)
12:43:12 PM:   Template render error: (/opt/build/repo/_includes/components/head.njk)
12:43:12 PM:   Error: template not found: backgrounds.css
12:43:12 PM: `Template render error` was thrown:
12:43:12 PM:     Template render error: (./_includes/layouts/base.njk)
12:43:12 PM:       Template render error: (/opt/build/repo/_includes/components/head.njk)
12:43:12 PM:       Error: template not found: backgrounds.css
12:43:12 PM:         at Object._prettifyError (/opt/build/repo/node_modules/nunjucks/src/lib.js:36:11)
12:43:12 PM:         at /opt/build/repo/node_modules/nunjucks/src/environment.js:561:19
12:43:12 PM:         at eval (eval at _compile (/opt/build/repo/node_modules/nunjucks/src/environment.js:631:18), <anonymous>:18:11)
12:43:12 PM:         at /opt/build/repo/node_modules/nunjucks/src/environment.js:569:11
12:43:12 PM:         at eval (eval at _compile (/opt/build/repo/node_modules/nunjucks/src/environment.js:631:18), <anonymous>:185:12)
12:43:12 PM:         at createTemplate (/opt/build/repo/node_modules/nunjucks/src/environment.js:293:11)
12:43:12 PM:         at next (/opt/build/repo/node_modules/nunjucks/src/lib.js:328:7)
12:43:12 PM:         at handle (/opt/build/repo/node_modules/nunjucks/src/environment.js:327:11)
12:43:12 PM:         at /opt/build/repo/node_modules/nunjucks/src/environment.js:337:9
12:43:12 PM:         at next (/opt/build/repo/node_modules/nunjucks/src/lib.js:326:7)
12:43:12 PM: Benchmark (Configuration): "cssmin" Nunjucks Filter took 3094ms (81.8%, called 9×, 343.7ms each)
12:43:12 PM: Copied 1 file / Wrote 0 files in 3.44 seconds (v0.11.1)
12:43:12 PM: ​
12:43:12 PM: ────────────────────────────────────────────────────────────────
12:43:12 PM:   "build.command" failed                                        
12:43:12 PM: ────────────────────────────────────────────────────────────────
12:43:12 PM: ​
12:43:12 PM:   Error message
12:43:12 PM:   Command failed with exit code 1: eleventy
12:43:12 PM: ​
12:43:12 PM:   Error location
12:43:12 PM:   In Build command from Netlify app:
12:43:12 PM:   eleventy
12:43:12 PM: ​
12:43:12 PM:   Resolved config
12:43:12 PM:   build:
12:43:12 PM:     command: eleventy
12:43:12 PM:     commandOrigin: ui
12:43:12 PM:     environment:
12:43:12 PM:       - ASSET_PATH
12:43:12 PM:       - CLOUDINARY_CLOUD_NAME
12:43:12 PM:       - ELEVENTY_ENV
12:43:12 PM:     publish: /opt/build/repo/_site
12:43:12 PM: Caching artifacts
12:43:12 PM: Started saving node modules
12:43:12 PM: Finished saving node modules
12:43:12 PM: Started saving build plugins
12:43:12 PM: Finished saving build plugins
12:43:12 PM: Started saving pip cache
12:43:12 PM: Finished saving pip cache
12:43:12 PM: Started saving emacs cask dependencies
12:43:12 PM: Finished saving emacs cask dependencies
12:43:12 PM: Started saving maven dependencies
12:43:12 PM: Finished saving maven dependencies
12:43:12 PM: Started saving boot dependencies
12:43:12 PM: Finished saving boot dependencies
12:43:12 PM: Started saving rust rustup cache
12:43:12 PM: Finished saving rust rustup cache
12:43:12 PM: Started saving rust cargo bin cache
12:43:12 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2
12:43:12 PM: Finished saving rust cargo bin cache
12:43:12 PM: Started saving go dependencies
12:43:12 PM: Finished saving go dependencies
12:43:12 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
12:43:12 PM: Failing build: Failed to build site
12:43:12 PM: Finished processing build request in 18.370210292s

Does this help: https://github.com/11ty/eleventy/issues/1024?

No, but that did make me think that maybe the period in the file name (backgrounds.css.njk) might be causing that. But no dice there.

I think the file isn’t being created fast enough for when the head.njk or base.njk file needs to use it. This is the error that makes me think that:

Error: template not found: backgrounds.css

I’m not sure how I can fix this issue since it’s not present on local.

Would you be willing to share the source code?

any chance at all its case issue?