question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

postcss plugins not found when compiling with CRA v5.0.0 and fomantic-ui

See original GitHub issue

Describe the bug

CRA v5 appears to be incompatible with fomantic-ui, since installing this package causes compile errors about postcss plugins not existing

Did you try recovering your dependencies?

Yes

❯ npm --version 8.5.4

Which terms did you search for in User Guide?

I searched for postcss

Environment

Environment Info:

current version of create-react-app: 5.0.0 running from /home/davidg/.npm/_npx/c67e74de0542c87c/node_modules/create-react-app

System: OS: Linux 5.10 Ubuntu 18.04.6 LTS (Bionic Beaver) CPU: (8) x64 Intel® Core™ i7-6700 CPU @ 3.40GHz Binaries: Node: 16.8.0 - ~/.nvm/versions/node/v16.8.0/bin/node Yarn: Not Found npm: 8.5.4 - ~/.nvm/versions/node/v16.8.0/bin/npm Browsers: Chrome: 99.0.4844.51 Firefox: Not Found npmPackages: react: ^17.0.2 => 17.0.2 react-dom: ^17.0.2 => 17.0.2 react-scripts: 5.0.0 => 5.0.0 npmGlobalPackages: create-react-app: Not Found

Steps to reproduce

  1. npx create-react-app@latest cra-test --use-npm

Follow documented fomantic-ui install instructions: 2. npm install --ignore-scripts fomantic-ui 3. cd node_modules/fomantic-ui 4. npx gulp install (select defaults) 5. npx gulp build 7. npm start (this works normally) 8. rm node_modules package-lock.json -Rf 9. npm install 10. npm start

Expected behavior

Successful compilation

Actual behavior

ERROR in ./src/index.css (./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[2]!./node_modules/source-map-loader/dist/cjs.js!./src/index.css) Module Error (from ./node_modules/postcss-loader/dist/cjs.js): Loading PostCSS “postcss-flexbugs-fixes” plugin failed: Cannot find module ‘postcss-flexbugs-fixes’ Require stack:

/home/davidg/cra-test/node_modules/postcss-loader/dist/utils.js /home/davidg/cra-test/node_modules/postcss-loader/dist/index.js /home/davidg/cra-test/node_modules/postcss-loader/dist/cjs.js /home/davidg/cra-test/node_modules/loader-runner/lib/loadLoader.js /home/davidg/cra-test/node_modules/loader-runner/lib/LoaderRunner.js /home/davidg/cra-test/node_modules/webpack/lib/NormalModule.js /home/davidg/cra-test/node_modules/webpack-manifest-plugin/dist/index.js /home/davidg/cra-test/node_modules/react-scripts/config/webpack.config.js /home/davidg/cra-test/node_modules/react-scripts/scripts/start.js

image

Reproducible demo

I hope the steps above are concise enough to serve as a reproducible demo also

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:12
  • Comments:6

github_iconTop GitHub Comments

4reactions
samuliasmalacommented, Mar 24, 2022

I have the same issue except I’m not using fomantic-ui but Material-UI. The npm install postcss-flexbugs-fixes postcss-normalize postcss-preset-env workaround also fixes the issue for me.

I believe something in my codebase is triggering the postcss which is failing since the packages are installed under node_modules/react-scripts/node_modules/

Before running npm install postcss-flexbugs-fixes

$ find node_modules/ -name 'postcss-flexbugs-fixes'
node_modules/react-scripts/node_modules/postcss-flexbugs-fixes

After running npm install postcss-flexbugs-fixes

$ find node_modules/ -name 'postcss-flexbugs-fixes'
node_modules/postcss-flexbugs-fixes

I’m pretty sure the above change in postcss-flexbugs-fixes package location is the reason why it starts working. Do you know if there’s a way to fix it other than installing those three packages? Also any idea what is triggering the postcss processing in cra application? I tried but couldn’t find the culprit from my fairly large codebase.

3reactions
toresennesethcommented, May 19, 2022

Rebuilding the lockfile worked for me as well.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Loading PostCSS "postcss-preset-env" plugin failed: Cannot ...
I'm getting the following error when trying to start a CRA project running with node 14.17.0 -> ...
Read more >
gatsby-plugin-postcss
gatsby-plugin-postcss Provides drop-in support for PostCSS Install How to use ... use the plugins options; see postcss-loader for all available options.
Read more >
How to setup Tailwind 3 in React with CRA 5 ? - GeeksforGeeks
PostCSS : Uses JavaScript-based plugins to automate routine CSS operations. ... an existing project make sure that you are using CRA version 5.0.0...
Read more >
使用CRA v5.0.0和Fomantic-UI编译时找不到PostCSS插件
postcss plugins not found when compiling with CRA v5.0.0 and fomantic-uiDescribe the bug CRA V5似乎与Fomantic-UI不兼容,因为安装此程序包导致 ...
Read more >
postcss | Transforming styles with JS plugins - kandi
Implement postcss with how-to, Q&A, fixes, code snippets. kandi ratings - Medium support, No Bugs, No Vulnerabilities. Permissive License, Build available.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found