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
While running env-cmd -f .env.staging react-scripts build
I'm getting the following error:
Creating an optimized production build...
(node:44878) [DEP_WEBPACK_COMPILATION_NORMAL_MODULE_LOADER_HOOK] DeprecationWarning: Compilation.hooks.normalModuleLoader was moved to NormalModule.getCompilationHooks(compilation).loader
(Use `node --trace-deprecation ...` to show where the warning was created)
Failed to compile.
static/css/5068.bd16ed94.chunk.css from Css Minimizer plugin
Error: PostCSS plugin postcss-discard-comments requires PostCSS 8.
Migration guide for end-users:
https://github.com/postcss/postcss/wiki/PostCSS-8-for-end-users
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! my-project-name@0.1.0 build:staging: `env-cmd -f .env.staging react-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the my-project-name@0.1.0 build:staging script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/noel/.npm/_logs/2021-12-20T19_55_17_952Z-debug.log
The migration guide, clearly doesn't help. It's talking about CRA 3
Did you try recovering your dependencies?
I tried removing and adding everything 3 million times, as usual.
Which terms did you search for in User Guide?
postcss
v4
css
Environment
I can't because some company policies.
I'm using MacOS
Steps to reproduce
Just run your build command (mine is env-cmd -f .env.staging react-scripts build). My command was working properly during 4 years. Broken after upgrading to V5
npm why exists at least in npm 8, but npm ls works fine. I think something has gone wrong in you install. Did you want to upgrade to react-scripts 5.0.0? You've got react-scripts version 5.0.0 create-react-app 5 should use PostCSS 8 (see release notes highlights), but in the output you've posted it says UNMET PEER DEPENDENCY.
Activity
BrodaNoel commentedon Dec 20, 2021
This should be the dependency with the problem:
ludofischer commentedon Dec 21, 2021
create-react-app 5 should be using PostCSS 8 already. Can you figure out why other versions of PostCSS are in your path (
npm why postcss)?BrodaNoel commentedon Dec 22, 2021
npm whydoesn't exists. you probably want to saynpm ls.This is the full result of
npm ls postcss:ludofischer commentedon Dec 23, 2021
npm whyexists at least in npm 8, butnpm lsworks fine. I think something has gone wrong in you install. Did you want to upgrade toreact-scripts5.0.0? You've gotreact-scriptsversion 5.0.0create-react-app5 should use PostCSS 8 (see release notes highlights), but in the output you've posted it saysUNMET PEER DEPENDENCY.BrodaNoel commentedon Jan 13, 2022
Fixed!
https://www.npmjs.com/package/@storybook/builder-webpack5
Seems like Storybook was using webpack4. So, after updating to webpack5 in storybooks, the error dissapeared.