Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flow crashes when seeing an invalid package.json #5898

Closed
dumbmatter opened this issue Mar 2, 2018 · 4 comments
Closed

Flow crashes when seeing an invalid package.json #5898

dumbmatter opened this issue Mar 2, 2018 · 4 comments

Comments

@dumbmatter
Copy link

See it in action on a real package:

$ yarn init
$ yarn add module-deps@6.0.0
$ yarn add flow-bin@0.66.0
$ touch .flowconfig
$ node_modules/.bin/flow
Launching Flow server for /home/jdscheff/projects/browserify-flow-bug/foo
Spawned flow server (pid=26513)
Logs will go to /tmp/flow/zShomezSjdscheffzSprojectszSbrowserify-flow-bugzSfoo.log
Monitor logs will go to /tmp/flow/zShomezSjdscheffzSprojectszSbrowserify-flow-bugzSfoo.monitor_log
Lost connection to the flow server (3 retries remaining)
Launching Flow server for /home/jdscheff/projects/browserify-flow-bug/foo
Spawned flow server (pid=26540)
Logs will go to /tmp/flow/zShomezSjdscheffzSprojectszSbrowserify-flow-bugzSfoo.log
Monitor logs will go to /tmp/flow/zShomezSjdscheffzSprojectszSbrowserify-flow-bugzSfoo.monitor_log
Lost connection to the flow server (2 retries remaining)
Launching Flow server for /home/jdscheff/projects/browserify-flow-bug/foo
Spawned flow server (pid=26557)
Logs will go to /tmp/flow/zShomezSjdscheffzSprojectszSbrowserify-flow-bugzSfoo.log
Monitor logs will go to /tmp/flow/zShomezSjdscheffzSprojectszSbrowserify-flow-bugzSfoo.monitor_log
Lost connection to the flow server (1 retry remaining)
Launching Flow server for /home/jdscheff/projects/browserify-flow-bug/foo
Spawned flow server (pid=26574)
Logs will go to /tmp/flow/zShomezSjdscheffzSprojectszSbrowserify-flow-bugzSfoo.log
Monitor logs will go to /tmp/flow/zShomezSjdscheffzSprojectszSbrowserify-flow-bugzSfoo.monitor_log
Lost connection to the flow server (0 retries remaining)
Out of retries, exiting!

$ echo "[ignore]" > .flowconfig
$ echo ".*/node_modules/module-deps/test/invalid_pkg/package.json" >> .flowconfig
$ node_modules/.bin/flow
Launching Flow server for /home/jdscheff/projects/browserify-flow-bug/foo
Spawned flow server (pid=26763)
Logs will go to /tmp/flow/zShomezSjdscheffzSprojectszSbrowserify-flow-bugzSfoo.log
Monitor logs will go to /tmp/flow/zShomezSjdscheffzSprojectszSbrowserify-flow-bugzSfoo.monitor_log
No errors!

Here is what that ignored file looks like:

"just a string"

Seems that the same thing happens when you have any file named package.json containing something like that.

I'm also going to submit a PR to module-deps to get them to stop putting tests in their npm package, but I figure it's a more general problem that you guys might want to look into.

@saul-mtz
Copy link

a workaround is to add the conflictive file to the [ignore] section in the .flowconfig file:

<PROJECT_ROOT>/node_modules/browserify-middleware/.*/test/.*

@dumbmatter
Copy link
Author

That's what I did, for the file that was causing me problems. But it's very poor usability to force users to do that, especially when the error message doesn't tell you what file (or even what dependency) is causing the problem. It's not easy to find the offending file if you have many dependencies.

@alexiusp
Copy link

have the same issue with this dependency

@nmote
Copy link
Contributor

nmote commented Feb 21, 2019

Looks like this was fixed in f942d96

@nmote nmote closed this as completed Feb 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants