Skip to content

npx create-react-app failed on windows #13768

Open
@yxxchange

Description

@yxxchange

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.)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions