4

Today I started learning react! and I am having difficulties.

I created a project using npx create-react-app my-app. If I use npm start, the application does not work. I have not made any changes to the project

The console contains this error:

react-refresh-runtime.development.js:465 Uncaught TypeError: Cannot read property 'forEach' of undefined
    at Object.injectIntoGlobalHook (react-refresh-runtime.development.js:465)
    at Object../node_modules/@pmmmwh/react-refresh-webpack-plugin/client/ReactRefreshEntry.js (ReactRefreshEntry.js:8)
    at __webpack_require__ (bootstrap:856)
    at fn (bootstrap:150)
    at Object.1 (reportWebVitals.js:14)
    at __webpack_require__ (bootstrap:856)
    at checkDeferredModules (bootstrap:45)
    at Array.webpackJsonpCallback [as push] (bootstrap:32)
    at main.chunk.js:1

How i can fix this error?

5
  • We need to see your code. Commented Dec 12, 2020 at 16:31
  • 1
    have you tried npm install ? Commented Dec 12, 2020 at 16:31
  • Did you add any dependency while installing the application? Also, did you try creating a brand new react app to see if the error still persists? Commented Dec 12, 2020 at 16:32
  • Siddhant Varma, yes i tried to re-create the app. but it did not help Commented Dec 12, 2020 at 16:50
  • cssyphus, this is the deffault react-project - github.com/KovbenyaAlexander/react-app Commented Dec 12, 2020 at 17:09

3 Answers 3

7

It appears that this issue has been around for a couple of months now, catching those who are new to Create React App. It's rather unfortunate but depending on your CRA version the solution is to either:

  • Install React Dev Tools plugin
  • Update React Dev Tools plugin
  • Uninstall/Disable React Dev Tools plugin

I've documented it here: https://github.com/facebook/create-react-app/issues/10500

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks a lot man, I was thinking the issue was NextJS spicific, agh who could have thought new dev-tools I have installed last week could cause this without details?
It is affecting BrowserStack too but disabling the React plugin saved the day! Thanks!
0

when you ran create-react-app my-app, you created a new directory called my-app. you need to make sure you're inside the my-app directory then when you run npm start it will open a browser window with a url of localhost:3000

2 Comments

the web application opens. but the page is blank and the console contains the error "Cannot read property 'forEach' of undefined"
you must of adjusted something with the code, I would just scrap those files and make a new directory. what i like doing is making the directory i want to work in before creating the react app then you go into that directory and do create-react-app .
0

This project work fine for me, delete node_modules and run npm i in my-app directory

2 Comments

it didn't help. ill try to reinstal nodejs
My node version is v14.15.1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.