Issues getting Django and Django Tailwind CSS to build

yayadrianHOBBY

10 months ago

I have a Django project that is using Django Tailwind.

In my railway.json I have this line:
"startCommand": "python3 manage.py tailwind build && python3 manage.py migrate && python3 manage.py collectstatic --noinput && gunicorn poll.wsgi"

I have Python and NodeJS set as Language providers.

tailwind build is the part that causes the below error.
ERROR FROM LOG:
container event container died
npm WARN config production Use --omit=dev instead.

theme@3.8.0 build:tailwind
cross-env NODE_ENV=production tailwindcss --postcss -i ./src/styles.css -o ../static/css/dist/styles.css --minify

node:events:496
throw er; // Unhandled 'error' event
^
Error: spawn tailwindcss ENOENT
at ChildProcess.handle.onexit (node:internal/childprocess:286:19)
at onErrorNT (node:internal/childprocess:484:16) at process.processTicksAndRejections (node:internal/process/taskqueues:82:21)
Emitted 'error' event on ChildProcess instance at:
at ChildProcess.handle.onexit (node:internal/childprocess:292:12)
at onErrorNT (node:internal/childprocess:484:16) at process.processTicksAndRejections (node:internal/process/taskqueues:82:21) {
errno: -2,
code: 'ENOENT',
syscall: 'spawn tailwindcss',
path: 'tailwindcss',
spawnargs: [
'--postcss',
'-i',
'./src/styles.css',
'-o',
'../static/css/dist/styles.css',
'--minify'
]
}

View Deploy details

ⓘ Deployment information is only viewable by project members and Railway employees.

3 Replies

9 months ago

Hello, what command do you need to run to generate the css?


yayadrianHOBBY

9 months ago

python3 manage.py tailwind build

is used to build the CSS with django-tailwinds.
Running locally is fine so not sure what I'm missing to make it crash


9 months ago

Could you simply build the css locally and upload it to your repo?


Issues getting Django and Django Tailwind CSS to build - Railway Help Station