npx create-react-app failed on windows
Describe the bug
I followed the documentation instructions to execute the command npx create-react-app myapp, but it failed. I've found that my situation is different from that of most people. Some people have similar problems to mine, but I haven't found a good solution online.
The problems are as follows:
`Installing packages. This might take a couple of minutes. Installing react, react-dom, and react-scripts with cra-template...
npm error code ERESOLVE npm error ERESOLVE could not resolve npm error npm error While resolving: [email protected] npm error Found: react@undefined npm error node_modules/react npm error react@"" from the root project npm error npm error Could not resolve dependency: npm error react-dom@"" from the root project npm error npm error Conflicting peer dependency: [email protected] npm error node_modules/react npm error peer react@"^19.0.0" from [email protected] npm error node_modules/react-dom npm error react-dom@"*" from the root project npm error npm error Fix the upstream dependency conflict, or retry npm error this command with --force or --legacy-peer-deps npm error to accept an incorrect (and potentially broken) dependency resolution. npm error npm error npm error For a full report see: npm error C:\Users\86152\AppData\Local\npm-cache_logs\2024-12-28T11_32_48_232Z-eresolve-report.txt npm error A complete log of this run can be found in: C:\Users\86152\AppData\Local\npm-cache_logs\2024-12-28T11_32_48_232Z-debug-0.log
Aborting installation. npm install --no-audit --save --save-exact --loglevel error react react-dom react-scripts cra-template has failed.
Deleting generated file... package.json Deleting my-app/ from C:\Users\86152\Desktop\frontend_learning Done. `
Did you try recovering your dependencies?
package.json content as following:
{ "name": "my-app", "version": "0.1.0", "private": true }
nvm -v : 1.1.12
npm -v : 10.9.0
node -v : v22.12.0
Environment
os: win11
Expected behavior
A widely praised project shouldn't have such fatal errors right at the beginning. Please help to solve this problem. Thank you very much.
Actual behavior
(Write what happened. Please add screenshots!)
Reproducible demo
(Paste the link to an example project and exact instructions to reproduce the issue.)
I'm also facing the same issue bro, if you had resolve then please help how did you do..
I'm also facing the same issue bro, if you had resolve then please help how did you do..
I solved my problem by change the source of npm,such as npm config set registry http://registry.npmmirror.com
I will definitely help you Bro.
First Verify Node.js and npm Installation
Run the following commands :
node -v npm -v
Ensure:
The Above command show you:
Node 18... or 16 later Npm 8.... or 9 or later
I my case use Vite which is (Faster and Lightweight) I'm also using it, npx have a lot's of issues during installation..
Instead of Create React App, use Vite. It’s a modern tool for setting up React projects quickly and efficiently.
Run the following commands one by one:
npm create @.** app-name -- --template react*
cd app-name
npm install
npm run dev
This will create a React app and start the development server.
You can access your app through http://localhost:3000 or the URL displayed in your terminal.
If Issue Not solved Then.👇
If the above solutions still fail, there might be an issue with your system's configuration:
Ensure you have a stable internet connection.
Must: Temporarily disable antivirus or firewall (if applicable) during installation.
Let me know how these steps go! If issue resolved then kindly send me "Resolved".
On Sat, Jan 18, 2025, 6:04 PM richer @.***> wrote:
I'm also facing the same issue bro, if you had resolve then please help how did you do.. Screenshot.10.png (view on web) https://github.com/user-attachments/assets/43debc66-93a6-4a82-bd98-74a00f8239aa
I solved my problem by change the source of npm,such as npm config set registry http://registry.npmmirror.com
— Reply to this email directly, view it on GitHub https://github.com/facebook/create-react-app/issues/13768#issuecomment-2599709622, or unsubscribe https://github.com/notifications/unsubscribe-auth/A7YGWICXAPW4A4ER3X2Q4R32LJGNBAVCNFSM6AAAAABUJXXWY2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKOJZG4YDSNRSGI . You are receiving this because you commented.Message ID: @.***>