Pages > Module 4 - module is not defined breaks JS execution

Hey all,
I’m working my way through the Pages track, but I’m having some trouble with getting everything running.
I’ve cloned the Locations Starter (Basic) repository and followed all the instructions, but even after npm install, I get this error on my console: Uncaught ReferenceError: module is not defined at index.js?v=39dd0d3b:5:3. This error leads me to the React index.js file within node_modules, failing on module.exports = require("./cjs/react.development.js");. This is breaking JS so I can’t get the map to load and continue through the units.

I’m currently using node v18.20.2. I’ve tried upgrading to 20, and reinstalling everything from scratch, but it’s still no use. There’s also a Failed to resolve dependency: react-dom/client, present in 'optimizeDeps.include' error message when I run npm run dev.
I’m guessing it might be related, but afaik I’d need to upgrade React to version 18 in order to use react-dom/client. Since the documentation doesn’t match the existing code from the starter repository (docs from Pages track use .cjs files, actual repository uses .ts and .js), is it possible there’s a step missing somewhere?

1 Like

I can confirm this, I also tried both versions. Just so that you can progress, you can view the application in a production build. Run npm run prod (pages prod), and it should open up a new browser tab on port 8000.

First training module they showed us how to use the Community, just to realize later that no one is responding to our problems.
They keep making changes to the sample code but then not updating the “Training”, I’m facing too many blockers because of that, and this one from this post is one of many.