django-tailwind, can't start dev server

Viewed 239

I've done everything according to the django-tailwind docs, but when I want to start the dev server I get the following error:

> theme@3.1.1 start /home/amir/projects/planning-project/src/theme/static_src
> npm run dev


> theme@3.1.1 dev /home/amir/projects/planning-project/src/theme/static_src
> cross-env NODE_ENV=development tailwindcss --postcss -i ./src/styles.css -o ../static/css/dist/styles.css -w

/home/amir/projects/planning-project/src/theme/static_src/node_modules/tailwindcss/lib/cli.js:300
        throw err;
        ^

TypeError: Object.fromEntries is not a function
    at args (/home/amir/projects/planning-project/src/theme/static_src/node_modules/tailwindcss/lib/cli.js:243:47)
    at Object.<anonymous> (/home/amir/projects/planning-project/src/theme/static_src/node_modules/tailwindcss/lib/cli.js:302:3)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! theme@3.1.1 dev: `cross-env NODE_ENV=development tailwindcss --postcss -i ./src/styles.css -o ../static/css/dist/styles.css -w`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the theme@3.1.1 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/amir/.npm/_logs/2022-02-11T09_27_46_003Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! theme@3.1.1 start: `npm run dev`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the theme@3.1.1 start script.

I have tried going into "theme/static_src/src" directory and running npm run build-postcss, based on an answer on GitHub issue tracker, but then I get :

npm ERR! missing script: build-postcss
1 Answers

Turns out since I installed node via the standard servers it was an old version. You need to install a newer node version to solve this problem.

Related