Next.jsでMUIのTypographyを設置すると「Element type is invalid」とエラーが出るときの対処法

2024-01-27

エラー

Next.jsにおいて、MUI要素であるTypographyを特定条件下で配置した際、以下のようなエラーが発生します。

Error: Element type is invalid. Received a promise that resolves to: undefined. Lazy element type must resolve to a class or function...

環境

Next.js : 14.0.4

対処法

特定バージョンの不具合の可能性が高いです。
バージョンを下げることで解決できます。

Next.js 14.0.3 であれば、問題なく動作します。
package.json の Next.js を 14.0.3 に書き換え、npm install を実行します。

文献

Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) in react native project