Hi Netlify Support Team,
I’m encountering an issue with my site build on Netlify. Locally, everything works perfectly: Tailwind CSS builds without any problems. However, during the Netlify build process, I get the following error:
sh: 1: tailwind: not found
My build command in netlify.toml is:
npm install && CI=1 npm run build
And in my package.json, the build script is:
“build”: “npx tailwindcss -i ./src/input.css -o ./dist/output.css --minify”
Despite this, the Netlify build cannot find the tailwindcss binary.
Here is my log:
10:37:28 AM: Netlify Build
10:37:28 AM: ────────────────────────────────────────────────────────────────
10:37:28 AM:
10:37:28 AM: ❯ Version
10:37:28 AM: @netlify/build 33.4.6
10:37:28 AM:
10:37:28 AM: ❯ Flags
10:37:28 AM: accountId: 684ea49c660dddb923f86e59
10:37:28 AM: baseRelDir: true
10:37:28 AM: buildId: 684fd79c2bf3200008d091b4
10:37:28 AM: deployId: 684fd79c2bf3200008d091b6
10:37:29 AM:
10:37:29 AM: ❯ Current directory
10:37:29 AM: /opt/build/repo
10:37:29 AM:
10:37:29 AM: ❯ Config file
10:37:29 AM: /opt/build/repo/netlify.toml
10:37:29 AM:
10:37:29 AM: ❯ Context
10:37:29 AM: production
10:37:29 AM:
10:37:29 AM: build.command from netlify.toml
10:37:29 AM: ────────────────────────────────────────────────────────────────
10:37:29 AM:
10:37:29 AM: $ npm install && CI=1 npm run build
10:37:29 AM: up to date, audited 133 packages in 453ms
10:37:29 AM: 38 packages are looking for funding
10:37:29 AM: runnpm fund
for details
10:37:29 AM: found 0 vulnerabilities
10:37:29 AM: > doodleidoo@1.0.0 build
10:37:29 AM: > npx tailwindcss -i ./src/input.css -o ./dist/output.css --minify
10:37:29 AM: sh: 1: tailwind: not found
10:37:29 AM:
10:37:29 AM: “build.command” failed
10:37:29 AM: ────────────────────────────────────────────────────────────────
10:37:29 AM:
10:37:29 AM: Error message
10:37:29 AM: Command failed with exit code 127: npm install && CI=1 npm run build (Search results for '"non-zero exit code: 127"' - Netlify Support Forums)
10:37:29 AM:
10:37:29 AM: Error location
10:37:29 AM: In build.command from netlify.toml:
10:37:29 AM: npm install && CI=1 npm run build
10:37:29 AM:
10:37:29 AM: Resolved config
10:37:29 AM: build:
10:37:29 AM: command: npm install && CI=1 npm run build
10:37:29 AM: commandOrigin: config
10:37:29 AM: publish: /opt/build/repo/dist
10:37:29 AM: publishOrigin: config
10:37:29 AM: functionsDirectory: /opt/build/repo/netlify/functions
10:37:30 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
10:37:30 AM: Failing build: Failed to build site
10:37:30 AM: Finished processing build request in 15.13s
10:37:30 AM: Failed during stage ‘building site’: Build script returned non-zero exit code: 2 (Search results for '"non-zero exit code: 2"' - Netlify Support Forums)
I have verified that tailwindcss is correctly installed as a dev dependency in my project. The node_modules folder is properly installed during the build.
Could you please help me understand why Netlify cannot locate the Tailwind CLI and how to fix this issue?
Thank you for your support.
Best regards,