Tailwind CSS purge failing "There are some lingering processes"

Site name: https://eriksolsen.netlify.app/
Build Log:

4:01:33 PM: Build ready to start
4:01:35 PM: build-image version: b0258b965567defc4a2d7e2f2dec2e00c8f73ad6
4:01:35 PM: build-image tag: v3.4.1
4:01:35 PM: buildbot version: 0a44c930054be748eff0c581d346282fece89cc0
4:01:35 PM: Fetching cached dependencies
4:01:35 PM: Starting to download cache of 139.7MB
4:01:36 PM: Finished downloading cache in 1.056056205s
4:01:36 PM: Starting to extract cache
4:01:43 PM: Finished extracting cache in 6.297106012s
4:01:43 PM: Finished fetching cache in 7.426330815s
4:01:43 PM: Starting to prepare the repo for build
4:01:43 PM: Netlify Large Media is enabled, running git commands with GIT_LFS_SKIP_SMUDGE=1
4:01:43 PM: Preparing Git Reference refs/heads/master
4:01:45 PM: Starting build script
4:01:45 PM: Installing dependencies
4:01:45 PM: Python version set to 2.7
4:01:46 PM: Started restoring cached node version
4:01:50 PM: Finished restoring cached node version
4:01:50 PM: v12.18.0 is already installed.
4:01:51 PM: Now using node v12.18.0 (npm v6.14.4)
4:01:51 PM: Started restoring cached build plugins
4:01:51 PM: Finished restoring cached build plugins
4:01:51 PM: Attempting ruby version 2.7.1, read from environment
4:01:53 PM: Using ruby version 2.7.1
4:01:53 PM: Using PHP version 5.6
4:01:53 PM: 5.2 is already installed.
4:01:53 PM: Using Swift version 5.2
4:01:53 PM: Started restoring cached node modules
4:01:53 PM: Finished restoring cached node modules
4:01:53 PM: Installing NPM modules using NPM version 6.14.4
4:01:57 PM: npm WARN eleventy@1.0.0 No description
4:01:57 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3 (node_modules/fsevents):
4:01:57 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
4:01:58 PM: audited 572 packages in 3.278s
4:01:58 PM: 25 packages are looking for funding
4:01:58 PM:   run `npm fund` for details
4:01:58 PM: found 0 vulnerabilities
4:01:58 PM: NPM modules installed
4:01:58 PM: Started restoring cached go cache
4:01:58 PM: Finished restoring cached go cache
4:01:58 PM: go version go1.14.4 linux/amd64
4:01:58 PM: go version go1.14.4 linux/amd64
4:01:58 PM: Installing missing commands
4:01:58 PM: Verify run directory
4:01:59 PM: ​
4:01:59 PM: β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
4:01:59 PM: β”‚        Netlify Build        β”‚
4:01:59 PM: β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
4:01:59 PM: ​
4:01:59 PM: ❯ Version
4:01:59 PM:   @netlify/build 5.0.2
4:01:59 PM: ​
4:01:59 PM: ❯ Flags
4:01:59 PM:   deployId: 5f94962d34fffa0007662e2c
4:01:59 PM:   mode: buildbot
4:01:59 PM: ​
4:01:59 PM: ❯ Current directory
4:01:59 PM:   /opt/build/repo
4:01:59 PM: ​
4:01:59 PM: ❯ Config file
4:01:59 PM:   No config file was defined: using default values.
4:01:59 PM: ​
4:01:59 PM: ❯ Context
4:01:59 PM:   production
4:01:59 PM: ​
4:01:59 PM: β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
4:01:59 PM: β”‚ 1. Build command from Netlify app β”‚
4:01:59 PM: β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
4:01:59 PM: ​
4:01:59 PM: $ npm run production
4:02:00 PM: > eleventy@1.0.0 production /opt/build/repo
4:02:00 PM: > npx tailwindcss build assets/css/tailwind.css -o assets/css/site.css & npx @11ty/eleventy
4:02:00 PM: Writing _build/blog/index.html from ./content/blog/blog.njk.
4:02:00 PM: Writing _build/index.html from ./content/index.njk.
4:02:00 PM: Writing _build/photography/index.html from ./content/photography/photography.njk.
4:02:00 PM: Writing _build/resume/index.html from ./content/resume/resume.njk.
4:02:00 PM: Writing _build/blog/car-photography-update/index.html from ./content/blog/car-photography-update/index.njk.
4:02:00 PM: Writing _build/blog/dynamic-bookmarks-in-google-chrome/index.html from ./content/blog/dynamic-bookmarks-in-google-chrome/index.njk.
4:02:00 PM: Writing _build/blog/out-with-the-batis-on-to-zony/index.html from ./content/blog/out-with-the-batis-on-to-zony/index.njk.
4:02:00 PM: Writing _build/blog/new-camera-and-lenses/index.html from ./content/blog/new-camera-and-lenses/index.njk.
4:02:00 PM: Copied 13 files / Wrote 8 files in 0.29 seconds (v0.11.1)
4:02:00 PM: ​
4:02:00 PM: (build.command completed in 1.1s)
4:02:01 PM: 
4:02:01 PM: ** WARNING **
4:02:01 PM: There are some lingering processes even after the build process finished:
4:02:01 PM: 
4:02:01 PM: USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
4:02:01 PM: buildbot    1355 79.0  0.2 646988 69080 ?        Rl   21:01   0:00 node /opt/buildhome/.nvm/versions/node/v12.18.0/bin/npx tailwindcss build assets/css/tailwind.css -o assets/css/site.css
4:02:01 PM: 
4:02:01 PM: Our builds do not kill your processes automatically, so please make sure
4:02:01 PM: that nothing is running after your build finishes, or it will be marked as
4:02:01 PM: failed since something is still running.
4:02:01 PM: ​
4:02:01 PM: β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
4:02:01 PM: β”‚   Netlify Build Complete    β”‚
4:02:01 PM: β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
4:02:01 PM: ​
4:02:01 PM: (Netlify Build completed in 1.1s)
4:02:01 PM: Caching artifacts
4:02:01 PM: Started saving node modules
4:02:01 PM: Finished saving node modules
4:02:01 PM: Started saving build plugins
4:02:01 PM: Cannot find module './selectors'
4:02:01 PM: Require stack:
4:02:01 PM: - /opt/build/repo/node_modules/postcss-selector-parser/dist/index.js
4:02:01 PM: - /opt/build/repo/node_modules/tailwindcss/lib/lib/substituteVariantsAtRules.js
4:02:01 PM: - /opt/build/repo/node_modules/tailwindcss/lib/processTailwindFeatures.js
4:02:01 PM: - /opt/build/repo/node_modules/tailwindcss/lib/index.js
4:02:01 PM: - /opt/build/repo/node_modules/tailwindcss/lib/cli/commands/build.js
4:02:01 PM: - /opt/build/repo/node_modules/tailwindcss/lib/cli/commands/index.js
4:02:01 PM: - /opt/build/repo/node_modules/tailwindcss/lib/cli/main.js
4:02:01 PM: - /opt/build/repo/node_modules/tailwindcss/lib/cli.js
4:02:01 PM: Finished saving build plugins
4:02:01 PM: Started saving pip cache
4:02:01 PM: Finished saving pip cache
4:02:01 PM: Started saving emacs cask dependencies
4:02:01 PM: Finished saving emacs cask dependencies
4:02:01 PM: Started saving maven dependencies
4:02:01 PM: Finished saving maven dependencies
4:02:01 PM: Started saving boot dependencies
4:02:01 PM: Finished saving boot dependencies
4:02:01 PM: Started saving go dependencies
4:02:01 PM: Finished saving go dependencies
4:02:01 PM: Build script success
4:02:01 PM: Starting to deploy site from '_build'
4:02:01 PM: Creating deploy tree 
4:02:01 PM: Creating deploy upload records
4:02:01 PM: 1 new files to upload
4:02:01 PM: 0 new functions to upload
4:02:02 PM: Starting post processing
4:02:02 PM: Post processing - HTML
4:02:02 PM: Post processing - header rules
4:02:02 PM: Post processing - redirect rules
4:02:02 PM: Post processing done
4:02:02 PM: Site is live ✨
4:02:22 PM: Finished processing build request in 46.875516934s

I’m struggling to figure out why it’s failing. Works fine on my local environment.

tailwind.config.js

const defaultTheme = require("tailwindcss/defaultTheme");

module.exports = {
    future: {
        purgeLayersByDefault: true,
    },
    purge: {
        preserveHtmlElements: false,
        enabled: true,
        content: [
            'content/**/*.njk'
        ],
    },
    theme: {
        extend: {
            fontFamily: {
                sans: ["Inter var", ...defaultTheme.fontFamily.sans]
            }
        }
    },
    plugins: [require("@tailwindcss/typography"), require("@tailwindcss/ui")]
};

After a few hours of debugging, I have found the solution to my issues.

I had to switch the order of the β€œproduction” script in package.json. Instead of running the Tailwind build first, I placed it second, behind the Eleventy build.

I also had to add my Netlify β€œpublish” folder to the Tailwind build folder structure. Here’s my new package.json line that fixes the issue:

"production": "npx @11ty/eleventy & npx tailwindcss build _build/assets/css/tailwind.css -o _build/assets/css/site.css"
1 Like

thank you for sharing!

1 Like