timonweb / django-tailwind

Django + Tailwind CSS = 💚
https://django-tailwind.readthedocs.io
MIT License
1.44k stars 88 forks source link

python manage.py tailwind start with SyntaxError: Unexpected token '.' #191

Open junwenwaynepeng opened 9 months ago

junwenwaynepeng commented 9 months ago

I follow the process in https://django-tailwind.readthedocs.io/en/latest/installation.html on my laptop, running windows 11, and everything goes smoothly. Then, I push it to my github repo and pull on the other device, running ubuntu 22.04. I have reset everything in settings.py. Because I already have a 'theme' app, so I cannot repeat the python manage.py tailwind init, but I carry out other steps. Until the last step, it returns the following error:

python manage.py tailwind start

theme@3.6.0 start npm run dev

theme@3.6.0 dev cross-env NODE_ENV=development tailwindcss --postcss -i ./src/styles.css -o ../static/css/dist/styles.css -w

/home/r409/projects/SeeNetwork/theme/static_src/node_modules/yaml/dist/compose/composer.js:33 if (prelude[i + 1]?.[0] !== '#') ^

SyntaxError: Unexpected token '.' at wrapSafe (internal/modules/cjs/loader.js:915:16) at Module._compile (internal/modules/cjs/loader.js:963:27) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10) at Module.load (internal/modules/cjs/loader.js:863:32) at Function.Module._load (internal/modules/cjs/loader.js:708:14) at Module.require (internal/modules/cjs/loader.js:887:19) at require (internal/modules/cjs/helpers.js:74:18) at Object. (/home/r409/projects/SeeNetwork/theme/static_src/node_modules/yaml/dist/index.js:3:16) at Module._compile (internal/modules/cjs/loader.js:999:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)

Valgueiro commented 9 months ago

I had this problem when running with node 12.x. When I changed to a newer version (20) it worked as expected

junwenwaynepeng commented 9 months ago

Yes. After I googled it for a couple of days. I realized it is not Django-tailwind's problem. However, my error was not vanishing after I upgraded to the latest version of node. Interestingly, it worked on Windows, but failed on Ubuntu. Usually, it was the other way. I suggested the authors to write a troubleshooting for this issue, because it seems like a common problem, and will make users who are not familiar with node.js (like me) misunderstand the problem is from Django-tailwind.