运行react项目,报错:

Uncaught TypeError: Cannot read properties of undefined (reading 'forEach')
    at Object.injectIntoGlobalHook (react-refresh-runtime.development.js:488)
    at Object../node_modules/@pmmmwh/react-refresh-webpack-plugin/client/ReactRefreshEntry.js (ReactRefreshEntry.js:17)
    at Object.options.factory (react refresh:6)
    at __webpack_require__ (bootstrap:24)
    at startup:4
    at startup:7

解决办法:

第一种: 将谷歌浏览器的扩展程序关闭,重启项目

第二种:找到报错行,将其注释掉,保存文件,重启项目

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐