flow icon indicating copy to clipboard operation
flow copied to clipboard

Flow errors on malformed package.json

Open simkessy opened this issue 4 years ago • 5 comments

I updated from Node 12 to Node 14 and now flow gives me this error:





$ repo/node_modules/.bin/flow check --max-warnings 0
  | Skipping /repo/client/<PROJECT_ROOT>/flow-typed/: No such file or directory
  |  
  | Error ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
  | ../../../libs/tools-common/node_modules/@babel/helper-define-polyfill-provider/node_modules/resolve/test/resolver/malformed_package_json/package.json:2:1
  |  
  | Unexpected end of input, expected the token }
  |  
  | 1│ {
  | 2│
  |  
  |  

My app is setup in a workspace and imports a package called /tools-common im not sure how that's causing a failure in my main app though

simkessy avatar Feb 10 '22 07:02 simkessy

What's your .flowconfig look like? Flow shouldn't be checking external modules like that unless it's been explicitly told to with [include]

mvitousek avatar Feb 10 '22 17:02 mvitousek

See also https://github.com/facebook/flow/issues/2364

We recently started to encounter this as well, I guess starting from 0.169. Never happened before. And we have nothing under [include] actually.

pascalduez avatar Feb 11 '22 22:02 pascalduez

@mroch Any ideas on what could be happening here?

mvitousek avatar Feb 14 '22 17:02 mvitousek

I added:

[ignore]
.*/**/malformed_package_json/package.json

simkessy avatar Feb 17 '22 19:02 simkessy

same here with flow 0.176.3 / Node 17.8.0 / CRA 5.0.1

The fix mentioned by @simkessy right above does the trick but as pointed out by @mvitousek I can't understand why flow even cares about a deep node_modules file like that 🤷

t-fritsch avatar Apr 23 '22 20:04 t-fritsch