nextjs报TypeError: Cannot read property 'forEach' of undefined

分类:技术最近更新:2026-04-15浏览:2510

在运行nextjs模板应用时,出现以下报错

bash
Uncaught TypeError: Cannot read property 'forEach' of undefined at Object.injectIntoGlobalHook (react-refresh-runtime.development.js?d75a:465) at eval (runtime.js?8cab:9) at Object../node_modules/_@next_react-refresh-utils@10.0.6@@next/react-refresh-utils/runtime.js (react-refresh.js?ts=1612267998751:24) at __webpack_require__ (webpack.js?ts=1612267998751:873) at checkDeferredModules (webpack.js?ts=1612267998751:46) at webpackJsonpCallback (webpack.js?ts=1612267998751:33) at webpack.js?ts=1612267998751:1015 at webpack.js?ts=1612267998751:1023

解决方案

删掉或者禁用浏览器插件中React Developer Tools。

20210202201927.jpg