NextJS TypeError:无法读取 null 的属性(读取“长度”)

tha*_*uy8 10 javascript typescript reactjs next.js

有人知道这个错误的原因吗?

warn  - Fast Refresh had to perform a full reload. Read more: https://nextjs.org/docs/basic-features/fast-refresh#how-it-works      
TypeError: Cannot read properties of null (reading 'length')
    at eval (webpack-internal:///./node_modules/next/dist/client/dev/error-overlay/hot-dev-client.js:262:55)
Run Code Online (Sandbox Code Playgroud)

我尝试注释掉页面中运行的任何组件并从头开始创建一个新的 NextJS-ts 项目,但错误仍然存​​在。

小智 5

是的,看起来像是下一个 13 个错误。据我所知,它似乎没有破坏任何东西。

可能const hasUpdates = Boolean(updatedModules.length);只需要以下内容const hasUpdates = Boolean(updatedModules && updatedModules.length);