Closed jakub-astrahit closed 1 year ago
I got the same issue. Can u help with this?
Just to add, I'm having the same issue with CRA v5
Steps to reproduce
npx create-react-app@5.0.0 my-app-test
cd my-app-test
npx cra-to-nx@latest
Looks like there may be a fix here: https://github.com/nrwl/cra-to-nx/commit/4a81360283cef5c639ad16001f9e93a86012dcd7
There is a new issue with clean installation. When I install fresh nx and then use cra-to-nx package, it finishes the installation successfully but the project does not start out of the box. This is the errors I am getting:
Compiled with problems:X
ERROR in ./src/App.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/App.css)
Module Error (from ../../node_modules/postcss-loader/dist/cjs.js):
Loading PostCSS "postcss-preset-env" plugin failed: Cannot find module 'postcss-preset-env'
Require stack:
- /home/app/node_modules/postcss-loader/dist/utils.js
- /home/myproj/node_modules/postcss-loader/dist/index.js
- /home/myproj/node_modules/postcss-loader/dist/cjs.js
- /home/myproj/node_modules/loader-runner/lib/loadLoader.js
- /home/myproj/node_modules/loader-runner/lib/LoaderRunner.js
- /home/myproj/node_modules/webpack/lib/NormalModule.js
- /home/myproj/node_modules/webpack-manifest-plugin/dist/index.js
- /home/myproj/node_modules/react-scripts/config/webpack.config.js
- /home/myproj/node_modules/@craco/craco/lib/cra.js
- /home/myproj/node_modules/@craco/craco/scripts/start.js
(@/home/myproj/apps/myapp/src/App.css)
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-preset-env" plugin failed: Cannot find module 'postcss-preset-env'
Require stack:
- /home/myproj/node_modules/postcss-loader/dist/utils.js
- /home/myproj/node_modules/postcss-loader/dist/index.js
- /home/myproj/node_modules/postcss-loader/dist/cjs.js
- /home/myproj/node_modules/loader-runner/lib/loadLoader.js
- /home/myproj/node_modules/loader-runner/lib/LoaderRunner.js
- /home/myproj/node_modules/webpack/lib/NormalModule.js
- /home/myproj/node_modules/webpack-manifest-plugin/dist/index.js
- /home/myproj/node_modules/react-scripts/config/webpack.config.js
- /home/myproj/node_modules/@craco/craco/lib/cra.js
- /home/myproj/node_modules/@craco/craco/scripts/start.js
(@/home/myproj/apps/myapp/src/index.css)
EDIT: I found out that you need to run npm install inside your CRA application. In my example above, I need to run npm install
inside the /home/myproj/apps/myapp
. After the installation, the module postcss-preset-env
gets installed.
Maybe this npm install
step should be included in cra-to-nx script?
This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs. If we missed this issue please reply to keep it active. Thanks for being a part of the Nx community! ๐
Has this been fixed yet?
attention: for anyone considering migrating to NX from CRA
id agree with the title of this problem, the script does not accomplish what it intends to and leaves the user is a state that is very difficult to troubleshoot.
To anyone currently using CRA and considering migrating to NX, I would re-consider as the challenge will likely not be worth the effort. Save NX for your next greenfield project.
This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs. If we missed this issue please reply to keep it active. Thanks for being a part of the Nx community! ๐
I will be closing this, since I think it has been fixed. Please feel free to reopen if you think the issue persists.
Here is our guide for React + Nx.
This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.
When I run a fresh install of create-react-app and then run cra-to-nx, it fails with this error:
What's the problem please?