This error message is associated with Babel7.
The cause of the error is mixing Babel 6 and Babel 7. Babel 7 is incompatible with Babel 6. Therefore your entire project must rely on Babel 7. If you check the stack trace you might see references to `node_modules/babel-core`. This means that your project has Babel 6 dependencies.
Make sure that you've installed all the correct babel 7 dependencies, e.g.:
In my case, I had installed babel-cli globally (e.g. npm i -g babel-cli). This is not recommended. Babel-cli should be installed locally in dev-dependencies with:
npm i @babel/cli --dev
With a local install you can be confident that you're really using Babel 7 cli instead of Babel 6 cli.
NextJs, for example, depends on Babel 6. Therefore it's currently impossible to use Babel 7 in a Nextjs project.
Babel 7 was only recently released and in time more projects will adopt Babel 7.