Error: Malformed PostCSS Configuration - NextJS
See original GitHub issueCurrent Behavior
Got an PostCSS Error
Expected Behavior
No error.
Steps to Reproduce
npm i @nrwl/next (use css only, option 1)
nx g @nrwl/next:app some-app
Failure Logs
~ ❯ nx serve some-app
> nx run some-app:serve
We detected TypeScript in your project and reconfigured your tsconfig.json file for you. Strict-mode is set to false by default.
The following suggested values were added to your tsconfig.json. These values can be changed to fit your project's needs:
- lib was set to dom,dom.iterable,esnext
- incremental was set to true
info - automatically enabled Fast Refresh for 1 custom loader
Error: A PostCSS Plugin was passed as a function using require(), but it must be provided as a string.
Read more: https://nextjs.org/docs/messages/postcss-shape
error - ../../node_modules/next/dist/build/webpack/loaders/css-loader/src/index.js??ruleSet[1].rules[2].oneOf[8].use[1]!../../node_modules/next/dist/build/webpack/loaders/postcss-loader/src/index.js??ruleSet[1].rules[2].oneOf[8].use[2]!./pages/styles.css
Error: Malformed PostCSS Configuration
at Array.forEach (<anonymous>)
[ ready ] on http://localhost:4200
Environment
> NX Report complete - copy this into the issue template
Node : 16.4.0
OS : darwin x64
npm : 7.18.1
nx : 13.7.3
@nrwl/angular : undefined
@nrwl/cli : 13.7.3
@nrwl/cypress : 13.7.3
@nrwl/detox : undefined
@nrwl/devkit : 13.7.3
@nrwl/eslint-plugin-nx : 13.7.3
@nrwl/express : undefined
@nrwl/jest : 13.7.3
@nrwl/js : 13.7.3
@nrwl/linter : 13.7.3
@nrwl/nest : undefined
@nrwl/next : 13.7.3
@nrwl/node : undefined
@nrwl/nx-cloud : 13.1.2
@nrwl/react : 13.7.3
@nrwl/react-native : undefined
@nrwl/schematics : undefined
@nrwl/storybook : 13.7.3
@nrwl/tao : 13.7.3
@nrwl/web : 13.7.3
@nrwl/workspace : 13.7.3
typescript : 4.5.5
rxjs : 6.6.7
---------------------------------------
Community plugins:
Issue Analytics
- State:
- Created 2 years ago
- Comments:6
Top Results From Across the Web
Advanced Features: Customizing PostCSS Config - Next.js
To customize the PostCSS configuration, create a postcss.config.json file in the root of your project. This is the default configuration used by Next.js:...
Read more >Why does create next app install with postcss errors
I change directory to app/client. I run npm run dev. I get this in console... Error: Your custom PostCSS configuration must export a...
Read more >Malformed PostCSS Configuration - Devkant Swargiary
Hi, I faced this error while trying to incorporate "Dark Mode". My project stack included : Next JS, Tailwind CSS. This error could...
Read more >Next.js local postcss plugin - Sung.codes
Error: Malformed PostCSS Configuration. Next.js requires an object-based form for postcss plugins. e.g.) So, instead of
Read more >Malformed PostCSS Configuration - Fueler
This error generally occurs when Nextjs is used with TailwindCSS. The work around is explained in this blog. This was a part of...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@krailler I was able to fix the issue at my end when i used the following in the
postcss.config.js
filemodule.exports = { plugins: [ 'postcss-import', 'tailwindcss/nesting', 'tailwindcss', 'autoprefixer', ] }
initially my codes were :
I hope it helps.
thanks bro