create-react-app: Cannot read property 'forEach' of undefined

Hello I created a project using npx create-react-app my-app. If i use npm start, compilation is successful, but the page is blank. I have not made any changes to the project. The console contains an 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

Screenshot: 2020-12-12 (2)

About this issue

  • Original URL
  • State: open
  • Created 6 years ago
  • Reactions: 1
  • Comments: 15

Most upvoted comments

Same here, running from npx here causes the same issue (no modifications maded)

EDIT: A workaround for now so you can keep on working: Disable the React DEV TOOLS extension on Chrome.

The problem comes from the global Hook which initiated wrong (Missing renderers prop on the object, which needs to be initiated with new Map())

@KovbenyaAlexander Close the Browser react plugin。

@avihaymenahem lol, I installed this extension and now the project is working correctly. but only in a browser with the extension

@arron-chen the same case with me. do you find better way to debug?

  • disable React Dev Tools plugin and refresh the localhost.
  • enable React Dev Tools everything working correctly now

@avihaymenahem lol, I installed this extension and now the project is working correctly. but only in a browser with the extension

that also worked for me. XD