PS F:\code\cloverleaf\web> npm view postcss version
8.1.2
PS F:\code\cloverleaf\web> npm run build
> cloverleaf-web@1.0.0 build F:\code\cloverleaf\web
> cross-env NODE_ENV=production node --no-deprecation config/webpack/config.js
Translations up to date
Processing translations
Finished processing translations
Build completed in 8.733s
assets by status 118 KiB [cached] 1 asset
runtime modules 1.1 KiB 8 modules
orphan modules 1.07 KiB [orphan] 1 module
modules by path ./node_modules/ 211 KiB 26 modules
modules by path ./src/ 20.8 KiB
./src/main.js 20.7 KiB [built] [code generated]
./src/style.scss 39 bytes [built] [code generated] [1 error]
modules by path ./data/*.json 2.64 KiB
./data/logos.json 1.53 KiB [built] [code generated]
./data/themes.json 1.11 KiB [built] [code generated]
./langs/langs.json 159 bytes [built] [code generated]
crypto (ignored) 15 bytes [optional] [built] [code generated]
ERROR in ./src/style.scss
Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
ModuleBuildError: Module build failed (from ./node_modules/postcss-loader/src/index.js):
Error: PostCSS plugin postcss-import requires PostCSS 8.
Migration guide for end-users:
https://github.com/postcss/postcss/wiki/PostCSS-8-for-end-users
at Processor.normalize (F:\code\cloverleaf\web\node_modules\postcss-loader\node_modules\postcss\lib\processor.js:153:15)
at new Processor (F:\code\cloverleaf\web\node_modules\postcss-loader\node_modules\postcss\lib\processor.js:56:25)
at postcss (F:\code\cloverleaf\web\node_modules\postcss-loader\node_modules\postcss\lib\postcss.js:55:10)
at F:\code\cloverleaf\web\node_modules\postcss-loader\src\index.js:140:12
at processResult (F:\code\cloverleaf\web\node_modules\webpack\lib\NormalModule.js:576:19)
at F:\code\cloverleaf\web\node_modules\webpack\lib\NormalModule.js:669:5
at F:\code\cloverleaf\web\node_modules\loader-runner\lib\LoaderRunner.js:397:11
at F:\code\cloverleaf\web\node_modules\loader-runner\lib\LoaderRunner.js:252:18
at context.callback (F:\code\cloverleaf\web\node_modules\loader-runner\lib\LoaderRunner.js:124:13)
at F:\code\cloverleaf\web\node_modules\postcss-loader\src\index.js:208:9
@ ./src/main.js 19:0-22
1 ERROR in child compilations
webpack 5.1.3 compiled with 2 errors in 8733 ms
We ended up pinning
postcss-importat 12.x while keeping up-to-date withpostcsson the latest branch:Closing, since no reduced test case has presented itself.
In my case it was a bunch of modules requesting postcss@7 as dependency. See
yarn why postcssSince the postcss API from 7 to 8 should not differ much I just resolved the issue by adding postcss@8 to the resolutions in package.jsonI’m not using any post css and I’m getting this when using
mini-css-extract-pluginJust ran into this myself today, the culprit being Storybook that references an older
postcss-loaderthat in turn imported an olderpostcss-import(https://github.com/storybookjs/storybook/blob/next/lib/core/package.json#L112)I think in my case it may be something to do with vuepress calling an older version of postcss under the hood…
Thanks @karladler at https://github.com/postcss/postcss-import/issues/435#issuecomment-939991463 for the yarn solution.
In my case, I am using npm.
I didn’t use
postcssdirectly. However, when Renovate does lock file maintenance of package-lock.json, it throws errorwhen I build my web app.
Because some dependencies of dependencies are using PostCSS 7
Adding overrides:
in package.json which is similar to
resolutionsfrom yarn.Then run
npm install. Next time, when Renovate does lock file maintenance of package-lock.json, it will use PostCSS 8 instead of PostCSS 7.Note
overridesgot supported since npm 8.3.0.peerDependenciesdoes not work for me in this Renovate lock file maintenance case. Some are still using PostCSS 7.I had trouble with
rollup-plugin-postcss. It worked, just runyarn add -D postcss@8.1.9andyarn add -D postcss-loader@4.1.0.I has this error happen to me while I only had postcss-cli in my explicit dependencies. Adding postcss as an explicit dependency fixed it.
On my file package.json I configured this:
I noticed the file package-lock.json had a section for an specific package I use (@ckeditor/ckeditor5-dev-utils) and it was requiring specific versions installed:
Just downgrade to “postcss-loader”: “^4.1.0”
Also I followed these links:
https://github.com/postcss/postcss/wiki/PostCSS-8-for-end-users https://evilmartians.com/chronicles/postcss-8-plugin-migration
Thanks @karladler. Elegant and effective solution. Afterwards I just had to refresh running
yarnand the error was gone.