facebook / create-react-app

Set up a modern web app by running one command.
https://create-react-app.dev
MIT License
102.62k stars 26.8k forks source link

Found: react@undefined when run npx create-react-app #11137

Open klezd opened 3 years ago

klezd commented 3 years ago

Describe the bug

Found: react@undefined
node_modules/react
  react@"*" from the root project

Could not resolve dependency:
peer react@"17.0.2" from react-dom@17.0.2
node_modules/react-dom
  react-dom@"*" from the root project

Fix the upstream dependency conflict, or retry
this command with --force, or --legacy-peer-deps
to accept an incorrect (and potentially broken) dependency resolution.

Error when running with create-react-app.

I have tried on an exisiting project to install package @material-ui and received similiar result as above (Found react@undefined)

Did you try recovering your dependencies?

(Write your answer here.)

Which terms did you search for in User Guide?

(Write your answer here if relevant.)

Environment

Environment Info:

  current version of create-react-app: 4.0.3
  running from C:\Users\sienn\AppData\Roaming\npm\node_modules\create-react-app

  System:
    OS: Windows 10 10.0.18363
    CPU: (8) x64 Intel(R) Core(TM) i5-10300H CPU @ 2.50GHz
  Binaries:
    Node: 16.3.0 - ~\AppData\Roaming\npm\node.CMD
    Yarn: Not Found
    npm: 7.18.1 - ~\AppData\Roaming\npm\npm.CMD
  Browsers:
    Chrome: Not Found
    Edge: Spartan (44.18362.449.0)
    Internet Explorer: 11.0.18362.1
  npmPackages:
    react: Not Found
    react-dom: Not Found
    react-scripts: Not Found
  npmGlobalPackages:
    create-react-app: Not Found

Steps to reproduce

(Write your steps here:)

  1. npx create-react-app my-app

Expected behavior

Successfully created React App

Actual behavior

image

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs.

Psalmcee commented 2 years ago

Screenshot (409) I just had it now!

christroutner commented 2 years ago

I'm also getting this error when trying to install react v18.2.2

cjseattle commented 2 years ago

In case this helps anyone, I had this issue as well. It turned out to be a problem with my local npm cache. Try this:

npm cache clean --force

Everything worked for me afterward.

npm cache docs: https://docs.npmjs.com/cli/v7/commands/npm-cache

From the docs for npm cache clean:

Delete all data out of the cache folder. Note that this is typically unnecessary, as npm's cache is self-healing and resistant to data corruption issues.

Well, sometimes it's necessary I guess. 🙂

patilhitendra commented 1 year ago

Nope It's not working for me. I have tried following thing as well to clean up all cache stuff.

npm cache clean --force

npm config rm proxy

npm config rm https-proxy

npm cache verify

Still facing same issue. for reference adding ss.

Screenshot 2023-03-04 at 9 35 37 AM
Leehyunji0715 commented 3 months ago

You should also check node version supporting the react version

node -v