./src/pages/tracks.js 43:10
Module parse failed: Unexpected token (43:10)
You may need an appropriate loader to handle this file type.
| columnNumber: 7
| }
Looks like webpack is unhappy for some reason.
Could be a few things, I’d recommend first checking for any potential trailing character at the end of the file that could have been typed by error (line 43 is passed the end of the component in the final client repo for track.js for example)
if that’s not the problem then we’d need a bit more info:
have you started from the repo shared in the course or from a blank project?
would you be able to link to your repo? It’ll be easier to understand what might be wrong with more context.
I checked for trailing characters in the track.js file and I don’t believe I spotted any. I started from the repo shared in the course (not a blank project).
Thanks for sharing your repo.
I found that your project is using an old version of react-scripts (^2.1.3) (this package is used by the create-react-app utility) and that version does not support optional chaining (support started at 3.3.0, hence breaking on that line in tracks.js:
{data?.tracksForHome?.map((track, index) => (
updating react-script to a newer version (in the original repo it’s ^4.0.3, but now the latest is 5.0.1) should fix your issue.
I believe this happened because earlier I was experiencing issues installing react. I would receive a number of vulnerabilities, so I ran npm audit fix --force (which I believe installed older versions) to resolve the critical issues. I also experienced this on the server side when I would perform npm install, but I have not run into further problems since.
running react@latest installed react 18 which is pretty recent and not compatible with some other packages we use in the project.
To solve your problem, the simplest way would be to replace your package.json with the one from final/client (then npm install after that).
(Or you can also manually revert the react and react-dom packages version to the original ones in your current package.json:
I was able to run your client app from your repo without issues, that means it might be your local project and its dependencies that are making problems.
You could try to delete the node_modules folder and then reinstall packages.
in your terminal, in the client directory, run: rm -r node_modules/
then npm install
In order to solve this error Either You need to downgrade the babel/core packages Or you need to downgrade the babel packages will fix your error. You can Read More about It At Here