I’m having problems using Tailwindcss v2.0+ with Hugo but when I try tailwindcss@^1.9, everything works fine.
Running Linux in a docker container (based on golang:1.15.5-alpine3.12) and using latest versions of postcss, autoprefixer and postcss-cli (all installed globally). Installed Hugo 0.79 from a tarball but also tried older versions.
dev_1 | Start building sites …
dev_1 | Built in 1652 ms
dev_1 | Error: Error building site: POSTCSS: failed to transform "css/styles.css" (text/css): Error: [object Object] is not a PostCSS plugin
dev_1 | at Processor.normalize (/usr/lib/node_modules/tailwindcss/node_modules/postcss/lib/processor.js:168:15)
dev_1 | at new Processor (/usr/lib/node_modules/tailwindcss/node_modules/postcss/lib/processor.js:52:25)
dev_1 | at postcss (/usr/lib/node_modules/tailwindcss/node_modules/postcss/lib/postcss.js:55:10)
dev_1 | at /usr/lib/node_modules/tailwindcss/lib/util/parseObjectStyles.js:24:33
dev_1 | at arrayMap (/usr/lib/node_modules/tailwindcss/node_modules/lodash/lodash.js:639:23)
dev_1 | at map (/usr/lib/node_modules/tailwindcss/node_modules/lodash/lodash.js:9580:14)
dev_1 | at Function.flatMap (/usr/lib/node_modules/tailwindcss/node_modules/lodash/lodash.js:9283:26)
dev_1 | at parseObjectStyles (/usr/lib/node_modules/tailwindcss/lib/util/parseObjectStyles.js:23:26)
dev_1 | at parseObjectStyles (/usr/lib/node_modules/tailwindcss/lib/util/parseObjectStyles.js:20:12)
dev_1 | at /usr/lib/node_modules/tailwindcss/lib/util/processPlugins.js:37:123
bf_web_dev_1 exited with code 255
If that does not work then check if all plugins are actually installed, but the Error: [object Object] is not a PostCSS plugin points to the configuration format.
Thank you for the suggestion. I tried it but got the same message. I think all the necessary packages are installed and it works fine with tailwindcss@^1.9
Has anybody else encountered a similar problem with Tailwindcss 2 and Hugo? It is perhaps worth mentioning that Tailwindcss 2 is a fairly new version, published 12 days.
I was not able to get it to work. Maybe it is related to the fact I installed the packages globally in a docker container.
...
RUN npm install -g autoprefixer@^10.0.4
RUN npm install -g postcss@^8.1.0
RUN npm install -g postcss-cli@^8.3.0
RUN npm install -g postcss-purgecss@^2.0.3
RUN npm install -g tailwindcss@2.0.1
...
Some dependencies were maybe not installed.
I did however stringify the object to get more info:
Error: Error building site: POSTCSS: failed to transform “css/styles.css” (text/css): Error: {“postcssPlugin”:“postcss-nested”} is not a PostCSS plugin
I don’t know if this helps.
I will try installing the packages locally in instead like you do in your examples.