next.js: Uncaught TypeError: Cannot read properties of undefined (reading 'default') at resolveModuleMetaData
Verify canary release
- I verified that the issue exists in the latest Next.js canary release
Provide environment information
$ npx --no-install next info
Operating System:
Platform: win32
Arch: x64
Version: Windows 10 Pro
Binaries:
Node: 16.18.0
npm: N/A
Yarn: N/A
pnpm: N/A
Relevant packages:
next: 13.0.1
eslint-config-next: 12.0.9
react: 18.2.0
react-dom: 18.2.0
warn - Latest canary version not detected, detected: "13.0.1", newest: "13.0.2-canary.2"
Experimental features used: appDir
What browser are you using? (if relevant)
Chrome (107.0.5304.88) / FireFox (106.0.3)
How are you deploying your application? (if relevant)
next dev
Describe the Bug
Note: Experimental features used: appDir
I have the following project setup (also see repo):

When I yarn dev and navigate to http://localhost:3000/route1, all is fine. Then, when I use the navigation bar to navigate to the other route (route2) I sometimes get the following error:
Uncaught TypeError: Cannot read properties of undefined (reading 'default')
at resolveModuleMetaData (webpack-internal:///(sc_server)/./node_modules/next/dist/compiled/react-server-dom-webpack/server.browser.js:195:82)
at serializeModuleReference (webpack-internal:///(sc_server)/./node_modules/next/dist/compiled/react-server-dom-webpack/server.browser.js:1298:50)
at resolveModelToJSON (webpack-internal:///(sc_server)/./node_modules/next/dist/compiled/react-server-dom-webpack/server.browser.js:1660:40)
at Array.toJSON (webpack-internal:///(sc_server)/./node_modules/next/dist/compiled/react-server-dom-webpack/server.browser.js:1081:40)
at stringify (<anonymous>)
at processModelChunk (webpack-internal:///(sc_server)/./node_modules/next/dist/compiled/react-server-dom-webpack/server.browser.js:163:36)
at retryTask (webpack-internal:///(sc_server)/./node_modules/next/dist/compiled/react-server-dom-webpack/server.browser.js:1823:50)
at performWork (webpack-internal:///(sc_server)/./node_modules/next/dist/compiled/react-server-dom-webpack/server.browser.js:1856:33)
at AsyncLocalStorage.run (node:async_hooks:330:14)
at eval (webpack-internal:///(sc_server)/./node_modules/next/dist/compiled/react-server-dom-webpack/server.browser.js:1934:55)
resolveErrorDev @ client.js?234c:691
processFullRow @ client.js?234c:756
processBinaryChunk @ client.js?234c:789
progress @ client.js?234c:842
--------------------------------------------------------------------------------------------------------------
react-dom.development.js?160d:21285 The above error occurred in the <ServerRoot> component:
at ServerRoot (webpack-internal:///./node_modules/next/dist/client/app-index.js:114:11)
at RSCComponent
at Root (webpack-internal:///./node_modules/next/dist/client/app-index.js:130:11)
Routing back and forth between route1 and route2 gives me the error 100% of the time
However, one clue:
Note that I have 'use client' on both pages for route1 and route2. When I remove either one of the 'use client' lines of the pages, the app works as expected. Why is this?
Expected Behavior
No error should occur when routing manually using the navigation bar.
Link to reproduction
https://github.com/JustinPraas/next13
To Reproduce
- Check out specified repo
yarn installyarn dev- Go to
http://localhost:3000/route1orhttp://localhost:3000/route2 - Now navigate to the other route (route1/route2 or vice versa) using the navigation bar
- Repeat step 5 until the mentioned error comes up in the console and the page stops rendering
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 10
- Comments: 18 (3 by maintainers)
Installed a new windows machine to verify this: in 13.0.1 it’s broken, 13.0.2 is fixed. Going to close this issue. If you’re running into something similar @Anirban20001962 please open a new issue with a reproduction. Thanks!
Indeed, it appears that just updated next with the following version seems to work :
npm install next@13.0.3-canary.0Same issue with the
13.0.1version, but working with the latest13.0.3-canary.0.Yup that’s correct. Whilst waiting for this to get fixed a nice workaround is using a container (base nodejs img) with a mount on ./src to get hot refresh.
On Thu, 3 Nov 2022, 18:29 Justin Praas, @.***> wrote:
Okay, Now I changed next to 13.0.4 from 13.0.1. This error gone. Thanks.
Good thinking. And yeah, just tested this on my linux machine (Ubuntu 16.04 lol) and it works as expected. A bit unfortunate. Hope this will get fixed soon.