score:11

Accepted answer

what's happening is that when you run npm start it's probably doing some checks with eslint, from what I remember create-react-app has some checks that break your build if you have eslint errors so makes sense that they're associated.

The error you're getting here is related to a node feature that eslint is using called subpath exports but it's support is hit or miss depending on how the library is consumed. This has been highlighted to cause issues when used with jest for example.

For the flowtype eslint plugin this is the exact line of code that's causing you issues.

You can also read about a similar issue reported regarding the typescript eslint plugin.


The solution and the reason I'm even able to understand what's causing this problem is that I made a fix to this yesterday in a clone of the eslint-plugin-flowtype (given that the original plugin had a lack of maintenance) here https://github.com/flow-typed/eslint-plugin-ft-flow/pull/23.

I'll raise an issue with create-react-app and see if they're willing to swap out the plugin with the new one which would have more maintenance and solve issues that you're experiencing.

score:1

DISABLE_ESLINT_PLUGIN=true react-app-rewired start can avoid this error, and no need of ">= node v14" (even node10 can work), for only eslint@8 is using Module.createRequire, ref to doc Upgrade to react-scripts@5 and Add Web Workers support and APP PixelShapeRN commit Add Web Workers support for CRA v5 (and Webpack 5)

score:2

I also found that I could resolve this issue by switching my node version to the LTS version.

  • I experienced this issue when running node version 12.13.0
  • Switching to version 16.14.2 resolves the issue for me.

score:4

I experienced the same problem in webstorm with react. My solution after reading some other peoples comments was to use Eslint version 7.32.0 i was originally using 6.8 which was causing the problems and now it works. I also read that version 8 or higher is not supported

score:5

i also had same problem. so In my case, I found my node version was v12. so i got to know CRA v5.x which should be with >= node v14. so I switched to Node v16.10.0 and solved it.

score:9

I fix this just deleting:

"eslintConfig": {
  "extends": [
    "react-app",
    "react-app/jest"
  ]
}

on package.json


Related Query

More Query from same tag