You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Throws "Error: PostCSS plugin postcss-import requires PostCSS 8" even when PostCSS 8 is installed #435
Reacted by Rody Molenaar, Vladislav Pilgasov, Drew Kennelly, Javier Garcia, Andrii Oriekhov, Hamza Khchichine, Svale Fossåskaret, Trigger, Jonas Thelemann and Ovidiu-Deliu
We ended up pinning postcss-import at 12.x while keeping up-to-date with postcss on the latest branch:
"postcss": "^8.1.9",
"postcss-import": "12.0.1",
Reacted by Devon Sams, Leonel Ubeda, pompeygao, Javier Garcia, Aslam Doctor, curlychoi, Eric McCormick, Sam McCord, Andrii Oriekhov, mmorkt and 66 more
Reacted by hazem-taha, Matt Woodruff, Lucas Simões, Reynaldo Salazar Jr., jihoon, Ruslan Ubaydullayev and OnlyGod Ovbije
Reacted by Alban Haouaci, Leonel Ubeda, Akshit Garg, Sam McCord, Andrii Oriekhov, Ray Caballero, hazem-taha, Murat, Rhy Moore, Daria-LM and 22 more
Reacted by hazem-taha, Matt Woodruff, Lucas Simões, Hiroya UGA, pland-baekco, Reynaldo Salazar Jr., Brandon Welsch, Christoph, Ihar Berasneu, jihoon and 8 more
Reacted by hazem-taha, Murat, Konstantin, Svale Fossåskaret, Tally, Matt Woodruff, Lucas Simões, pland-baekco, Reynaldo Salazar Jr., Brandon Welsch and 10 more
For anyone else whom @simenbrekken's does not work for, you might have installed postcss-cli globally. Please update the CLI to at least version 8, which loads version 8 of postcss. That's what worked for me.
In my case it was a bunch of modules requesting postcss@7 as dependency. See yarn why postcss
Since 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.json
"resolutions": {
"postcss": "8"
}
Reacted by Francesco Mussi, Tanner Lee Woody, Andrii Oriekhov, Rukundo Kevin, Javier Cestau, deployn and Richard T. Miles
Reacted by Richard Croft and Javier Cestau
Reacted by Tanner Lee Woody, Javier Cestau, Yunus Emre Tatar and Richard T. Miles
I had a similar error on building a Grafana plugin, but the dependencies are internal to the plugin (I can't update them).
However, it worked for me just by using yarn instead of npm.
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:
"@ckeditor/ckeditor5-dev-utils": {
"version": "31.1.5",
"resolved": "https://registry.npmjs.org/@ckeditor/ckeditor5-dev-utils/-/ckeditor5-dev-utils-31.1.5.tgz",
"integrity": "sha512-0hBxhrA0aLkLHxmC3Pc9ruebELeWtOFqK599Lo304CdA3R9UOIYwHnNCXw8NTwnxAtPuvsqAATwbHGEV/tpy9g==",
"requires": {
"postcss": "^8.4.12",
"postcss-import": "^14.1.0",
"postcss-loader": "^4.3.0",
"postcss-mixins": "^9.0.2",
"postcss-nesting": "^10.1.4",
},
"dependencies": {
[rest of the list of dependences].
}
},
Activity
RyanZim commentedon Oct 22, 2020
Is
postcss-loaderup to date?ChildishGiant commentedon Oct 22, 2020
Yep, 4.0.4
www-chique commentedon Oct 25, 2020
Got the same error. Everything else seems up-to-date.
Following the examples from this article: https://codechips.me/svelte-postcss-and-typescript-with-svite/
I gave a little bit of context as I am clueless and maybe the error isn't even related to this package. If you need more information, I will try to provide.
RyanZim commentedon Oct 27, 2020
What's the output of
npm lsfrom within the project directory?songololo commentedon Oct 29, 2020
Same issues here.
Output from
npm ls:RyanZim commentedon Oct 30, 2020
TBH, I am completely mystified why this is happening. Can somebody make a reduced test case?
songololo commentedon Oct 30, 2020
I think in my case it may be something to do with vuepress calling an older version of postcss under the hood...
aveltras commentedon Nov 16, 2020
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.
simenbrekken commentedon Nov 17, 2020
Just 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)Manubi commentedon Nov 29, 2020
So what's the solution? :D
simenbrekken commentedon Nov 29, 2020
We ended up pinning
postcss-importat 12.x while keeping up-to-date withpostcsson the latest branch:aslamdoctor commentedon Dec 12, 2020
@simenbrekken thank you. That worked.
rabota-alexey commentedon Jan 26, 2021
Just downgrade to
"postcss-loader": "^4.1.0"
picocodes commentedon Feb 10, 2021
For anyone else whom @simenbrekken's does not work for, you might have installed postcss-cli globally. Please update the CLI to at least version 8, which loads version 8 of postcss. That's what worked for me.
wallace-sf commentedon Feb 13, 2021
Same here.
2 remaining items
upgraded docusaurus, issues with postCSS 8, temporary solution is pin…
Merge branch 'master' of git://github.com/EarthCubeGeochron/Sparrow i…
Merge commit '279984c' into new-master
Merge branch 'main' into develop
Merge remote-tracking branch 'origin/develop' into failing-test
RyanZim commentedon Mar 31, 2021
Closing, since no reduced test case has presented itself.
testacode commentedon Jul 15, 2021
I'm not using any post css and I'm getting this when using
mini-css-extract-pluginkarladler commentedon Oct 11, 2021
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.json
FrancescoMussi commentedon Nov 2, 2021
Thanks @karladler.
Elegant and effective solution.
Afterwards I just had to refresh running
yarnand the error was gone.duc168 commentedon Dec 14, 2021
I had trouble with
rollup-plugin-postcss.It worked, just run
yarn add -D [email protected]andyarn add -D [email protected].leandro-ortiz-encora commentedon Jan 26, 2022
I had a similar error on building a Grafana plugin, but the dependencies are internal to the plugin (I can't update them).
However, it worked for me just by using yarn instead of npm.
jotapardo commentedon Nov 4, 2022
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:
jotapardo commentedon Nov 4, 2022
Also I followed these links:
https://github.com/postcss/postcss/wiki/PostCSS-8-for-end-users
https://evilmartians.com/chronicles/postcss-8-plugin-migration
hongbo-miao commentedon Nov 20, 2022
Thanks @karladler at #435 (comment) 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.