Accepted answer

Sorry I forgot to install babel-preset-react:

$ npm install babel-preset-react --save-dev


I just wanted to add that I got the error after I uninstalled an old npm module I wasn't using in my project anymore. Which was weird because I wasn't using it anywhere - how could uninstalling something that isn't used anywhere cause an error?

Turns out that one of that modules sub-dependencies had babel-preset-react, which I had missed installing to my own project when I started it. Thus, uninstalling that package also uninstalled the critical babel-preset-react!

For over a year, my react app could compile thanks to another package's sub-dependency...

So yes, installing babel-preset-react solved the issue for me.

Related Query

More Query from same tag