Are you getting this error with react-leaflet or other packages. If you are then it's most likely related to babel and there is an easy fix. Let me explain the issue and show you the solution that updates the package.json file instead of downgrading your package.
The error in this video is related to the latest version of react-leaflet 3.2.1. It has an issue with the nullish coalescing operator in a react-leaflet sub library @react-leaflet/core. This error can also happen with other package
Failed to compile
./node_modules/@react-leaflet/core/esm/path.js 10:41
Module parse failed: Unexpected token (10:41)
File was processed with these loaders:
./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
| useEffect(function updatePathOptions() {
| if (props.pathOptions !== optionsRef.current) {
const options = props.pathOptions ?? {};
| element.instance.setStyle(options);
| optionsRef.current = options;
0:00 Understand Problem
1:48 Solution