facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
118.37k stars 24.25k forks source link

Flow Type Errors Examples/UIExplorer #938

Closed chrisalexander55 closed 9 years ago

chrisalexander55 commented 9 years ago

The examples directory generates Flow errors. Did I do anything wrong? Works on Mac I configured at work but not at home (same OSX version with installed updates). Also, I can't detect if any dependenc(ies) have been updated since arriving at home.

Here is the screen cap:

screen shot 2015-04-20 at 9 14 42 pm

And here is the Flow printf:

flow: Running static typechecks. flow: Error running command cd "/Users/james/Projects/react-native" && flow --json --timeout 20: {"status":500,"message":"Flow found type errors. If you think these are wrong, make sure your flow bin and .flowconfig are up to date, or disable with --skipflow.","type":"FlowError","errors":[{"description":"E1: \nFailure(\"internal error: package /Users/james/Projects/node_modules/react-native/package.json not found\")","filename":"/Users/james/Projects/react-native/Examples/2048/Game2048.js","lineNumber":0,"column":0},{"description":"E2: \nFailure(\"internal error: package /Users/james/Projects/node_modules/react-native/package.json not found\")","filename":"/Users/james/Projects/react-native/Examples/Movies/MovieCell.js","lineNumber":0,"column":0},{"description":"E3: \nFailure(\"internal error: package /Users/james/Projects/node_modules/react-native/package.json not found\")","filename":"/Users/james/Projects/react-native/Examples/Movies/MovieScreen.js","lineNumber":0,"column":0},{"description":"E4: \nFailure(\"internal error: package /Users/james/Projects/node_modules/react-native/package.json not found\")","filename":"/Users/james/Projects/react-native/Examples/Movies/MoviesApp.js","lineNumber":0,"column":0},{"description":"E5: \nFailure(\"internal error: package /Users/james/Projects/node_modules/react-native/package.json not found\")","filename":"/Users/james/Projects/react-native/Examples/Movies/SearchScreen.js","lineNumber":0,"column":0},{"description":"E6: \nFailure(\"internal error: package /Users/james/Projects/node_modules/react-native/package.json not found\")","filename":"/Users/james/Projects/react-native/Examples/Movies/getStyleFromScore.js","lineNumber":0,"column":0},{"description":"E7: \nFailure(\"internal error: package /Users/james/Projects/node_modules/react-native/package.json not found\")","filename":"/Users/james/Projects/react-native/Examples/TicTacToe/TicTacToeApp.js","lineNumber":0,"column":0},{"description":"E8: \nFailure(\"internal error: package /Users/james/Projects/node_modules/react-native/package.json not found\")","filename":"/Users/james/Projects/react-native/Examples/UIExplorer/ActionSheetIOSExample.js","lineNumber":0,"column":0},{"description":"E9: \nFailure(\"internal error: package /Users/james/Projects/node_modules/react-native/package.json not found\")","filename":"/Users/james/Projects/react-native/Examples/UIExplorer/ActivityIndicatorIOSExample.js","lineNumber":0,"column":0},{"description":"E10: \nFailure(\"internal error: package /Users/james/Projects/node_modules/react-native/package.json not found\")","filename":"/Users/james/Projects/react-native/Examples/UIExplorer/AdSupportIOSExample.js","lineNumber":0,"column":0},{"description":"E11: \nFailure(\"internal error: package /Users/james/Projects/node_modules/react-native/package.json not found\")","filename":"/Users/james/Projects/react-native/Examples/UIExplorer/AlertIOSExample.js","lineNumber":0,"column":0},{"description":"E12: \nFailure(\"internal error: package /Users/james/Projects/node_modules/react-native/package.json not found\")","filename":"/Users/james/Projects/react-native/Examples/UIExplorer/AppStateIOSExample.js","lineNumber":0,"column":0},{"description":"E13: \nFailure(\"internal error: package /Users/james/Projects/node_modules/react-native/package.json not found\")","filename":"/Users/james/Projects/react-native/Examples/UIExplorer/AsyncStorageExample.js","lineNumber":0,"column":0},{"description":"E14: \nFailure(\"internal error: package /Users/james/Projects/node_modules/react-native/package.json not found\")","filename":"/Users/james/Projects/react-native/Examples/UIExplorer/CameraRollExample.ios.js","lineNumber":0,"column":0},{"description":"E15: \nFailure(\"internal error: package /Users/james/Projects/node_modules/react-native/package.json not found\")","filename":"/Users/james/Projects/react-native/Examples/UIExplorer/CameraRollView.ios.js","lineNumber":0,"column":0},{"description":"E16: \nFailure(\"internal error: package /Users/james/Projects/node_modules/react-native/package.json not found\")","filename":"/Users/james/Projects/react-native/Examples/UIExplorer/DatePickerIOSExample.js","lineNumber":0,"column":0},{"description":"E17: \nFailure(\"internal error: package /Users/james/Projects/node_modules/react-native/package.json not found\")","filename":"/Users/james/Projects/react-native/Examples/UIExplorer/GeolocationExample.js","lineNumber":0,"column":0},{"description":"E18: \nFailure(\"internal error: package /Users/james/Projects/node_modules/react-native/package.json not found\")","filename":"/Users/james/Projects/react-native/Examples/UIExplorer/ImageCapInsetsExample.js","lineNumber":0,"column":0},{"description":"E19: \nFailure(\"internal error: package /Users/james/Projects/node_modules/react-native/package.json not found\")","filename":"/Users/james/Projects/react-native/Examples/UIExplorer/ImageExample.js","lineNumber":0,"column":0},{"description":"E20: \nFailure(\"internal error: package /Users/james/Projects/node_modules/react-native/package.json not found\")","filename":"/Users/james/Projects/react-native/Examples/UIExplorer/LayoutExample.js","lineNumber":0,"column":0},{"description":"E21: \nFailure(\"internal error: package /Users/james/Projects/node_modules/react-native/package.json not found\")","filename":"/Users/james/Projects/react-native/Examples/UIExplorer/ListViewExample.js","lineNumber":0,"column":0},{"description":"E22: \nFailure(\"internal error: package /Users/james/Projects/node_modules/react-native/package.json not found\")","filename":"/Users/james/Projects/react-native/Examples/UIExplorer/ListViewPagingExample.js","lineNumber":0,"column":0},{"description":"E23: \nFailure(\"internal error: package /Users/james/Projects/node_modules/react-native/package.json not found\")","filename":"/Users/james/Projects/react-native/Examples/UIExplorer/MapViewExample.js","lineNumber":0,"column":0},{"description":"E24: \nFailure(\"internal error: package /Users/james/Projects/node_modules/react-native/package.json not found\")","filename":"/Users/james/Projects/react-native/Examples/UIExplorer/NavigatorIOSExample.js","lineNumber":0,"column":0},{"description":"E25: \nFailure(\"internal error: package /Users/james/Projects/node_modules/react-native/package.json not found\")","filename":"/Users/james/Projects/react-native/Examples/UIExplorer/NetInfoExample.js","lineNumber":0,"column":0},{"description":"E26: \nFailure(\"internal error: package /Users/james/Projects/node_modules/react-native/package.json not found\")","filename":"/Users/james/Projects/react-native/Examples/UIExplorer/PanResponderExample.js","lineNumber":0,"column":0},{"description":"E27: \nFailure(\"internal error: package /Users/james/Projects/node_modules/react-native/package.json not found\")","filename":"/Users/james/Projects/react-native/Examples/UIExplorer/PickerIOSExample.js","lineNumber":0,"column":0},{"description":"E28: \nFailure(\"internal error: package /Users/james/Projects/node_modules/react-native/package.json not found\")","filename":"/Users/james/Projects/react-native/Examples/UIExplorer/PointerEventsExample.js","lineNumber":0,"column":0},{"description":"E29: \nFailure(\"internal error: package /Users/james/Projects/node_modules/react-native/package.json not found\")","filename":"/Users/james/Projects/react-native/Examples/UIExplorer/PushNotificationIOSExample.js","lineNumber":0,"column":0},{"description":"E30: \nFailure(\"internal error: package /Users/james/Projects/node_modules/react-native/package.json not found\")","filename":"/Users/james/Projects/react-native/Examples/UIExplorer/ResponderExample.js","lineNumber":0,"column":0},{"description":"E31: \nFailure(\"internal error: package /Users/james/Projects/node_modules/react-native/package.json not found\")","filename":"/Users/james/Projects/react-native/Examples/UIExplorer/ScrollViewExample.js","lineNumber":0,"column":0},{"description":"E32: \nFailure(\"internal error: package /Users/james/Projects/node_modules/react-native/package.json not found\")","filename":"/Users/james/Projects/react-native/Examples/UIExplorer/SliderIOSExample.js","lineNumber":0,"column":0},{"description":"E33: \nFailure(\"internal error: package /Users/james/Projects/node_modules/react-native/package.json not found\")","filename":"/Users/james/Projects/react-native/Examples/UIExplorer/StatusBarIOSExample.js","lineNumber":0,"column":0},{"description":"E34: \nFailure(\"internal error: package /Users/james/Projects/node_modules/react-native/package.json not found\")","filename":"/Users/james/Projects/react-native/Examples/UIExplorer/SwitchIOSExample.js","lineNumber":0,"column":0},{"description":"E35: \nFailure(\"internal error: package /Users/james/Projects/node_modules/react-native/package.json not found\")","filename":"/Users/james/Projects/react-native/Examples/UIExplorer/TabBarIOSExample.js","lineNumber":0,"column":0},{"description":"E36: \nFailure(\"internal error: package /Users/james/Projects/node_modules/react-native/package.json not found\")","filename":"/Users/james/Projects/react-native/Examples/UIExplorer/TextExample.ios.js","lineNumber":0,"column":0},{"description":"E37: \nFailure(\"internal error: package /Users/james/Projects/node_modules/react-native/package.json not found\")","filename":"/Users/james/Projects/react-native/Examples/UIExplorer/TextInputExample.js","lineNumber":0,"column":0},{"description":"E38: \nFailure(\"internal error: package /Users/james/Projects/node_modules/react-native/package.json not found\")","filename":"/Users/james/Projects/react-native/Examples/UIExplorer/TimerExample.js","lineNumber":0,"column":0},{"description":"E39: \nFailure(\"internal error: package /Users/james/Projects/node_modules/react-native/package.json not found\")","filename":"/Users/james/Projects/react-native/Examples/UIExplorer/TouchableExample.js","lineNumber":0,"column":0},{"description":"E40: \nFailure(\"internal error: package /Users/james/Projects/node_modules/react-native/package.json not found\")","filename":"/Users/james/Projects/react-native/Examples/UIExplorer/UIExplorerApp.js","lineNumber":0,"column":0},{"description":"E41: \nFailure(\"internal error: package /Users/james/Projects/node_modules/react-native/package.json not found\")","filename":"/Users/james/Projects/react-native/Examples/UIExplorer/UIExplorerBlock.js","lineNumber":0,"column":0},{"description":"E42: \nFailure(\"internal error: package /Users/james/Projects/node_modules/react-native/package.json not found\")","filename":"/Users/james/Projects/react-native/Examples/UIExplorer/UIExplorerList.js","lineNumber":0,"column":0},{"description":"E43: \nFailure(\"internal error: package /Users/james/Projects/node_modules/react-native/package.json not found\")","filename":"/Users/james/Projects/react-native/Examples/UIExplorer/UIExplorerPage.js","lineNumber":0,"column":0},{"description":"E44: \nFailure(\"internal error: package /Users/james/Projects/node_modules/react-native/package.json not found\")","filename":"/Users/james/Projects/react-native/Examples/UIExplorer/UIExplorerTitle.js","lineNumber":0,"column":0},{"description":"E45: \nFailure(\"internal error: package /Users/james/Projects/node_modules/react-native/package.json not found\")","filename":"/Users/james/Projects/react-native/Examples/UIExplorer/VibrationIOSExample.js","lineNumber":0,"column":0},{"description":"E46: \nFailure(\"internal error: package /Users/james/Projects/node_modules/react-native/package.json not found\")","filename":"/Users/james/Projects/react-native/Examples/UIExplorer/ViewExample.js","lineNumber":0,"column":0},{"description":"E47: \nFailure(\"internal error: package /Users/james/Projects/node_modules/react-native/package.json not found\")","filename":"/Users/james/Projects/react-native/Examples/UIExplorer/WebViewExample.js","lineNumber":0,"column":0},{"description":"E48: \nFailure(\"internal error: package /Users/james/Projects/node_modules/react-native/package.json not found\")","filename":"/Users/james/Projects/react-native/Examples/UIExplorer/createExamplePage.js","lineNumber":0,"column":0}]}

mwilc0x commented 9 years ago

Try:

brew update brew upgrade flow

chris-alexander55 commented 9 years ago

Yes, I did. flow --version === 0.9.1. I'm up to date. Any other suggestions?

bobeagan commented 9 years ago

You might need to do a brew update first. Seems like 0.9.2 is latest.

admmasters commented 9 years ago

I had this issue as well. Was unaware that brew had to be updated to determine the most recent flow version.

chrisalexander55 commented 9 years ago

Despite updating Flow to 0.9.2, the error persists. Is this a Flow issue or React-Native issue. No clear direction on what to do next...

kozlowskij commented 9 years ago

Flow upgrade worked for me.

watsonwu9 commented 9 years ago

I had the same issue even after flow upgrade. the error msg is flow: Error running command cd "/Users/IAN/Desktop/yiqixie/yiqixie" && flow --json --timeout 20: {"status":500,"message":"Flow found type errors. If you think these are wrong, make sure your flow bin and .flowconfig are up to date, or disable with --skipflow.","type":"FlowError","errors":[{"description":"E1: invariant\nDuplicate module provider","filename":"/Users/IAN/Desktop/yiqixie/yiqixie/node_modules/react-native/node_modules/react-tools/src/vendor/core/invariant.js","lineNumber":0,"column":0},{"description":" E1: current provider","filename":"/Users/IAN/Desktop/yiqixie/yiqixie/node_modules/flux/lib/invariant.js","lineNumber":0,"column":0

davidpfahler commented 9 years ago

I just installed react-native-cli, created a project with react-native init and updated brew and upgraded flow. flow --version says 0.10.0. I get the following error when running flow --json:

{"passed":false,"errors":[{"message":[{"descr":"undefined\nThis type is incompatible with","code":0,"path":"/Users/djpfahler/localhost/smile/node_modules/react-native/Libraries/Components/TabBarIOS/TabBarItemIOS.ios.js","line":70,"endline":70,"start":15,"end":34},{"descr":"boolean","code":0,"path":"/Users/djpfahler/localhost/smile/node_modules/react-native/Libraries/Components/TabBarIOS/TabBarItemIOS.ios.js","line":91,"endline":91,"start":62,"end":68}]},{"message":[{"descr":"undefined\nThis type is incompatible with","code":0,"path":"/Users/djpfahler/localhost/smile/node_modules/react-native/Libraries/ReactIOS/ReactIOSMount.js","line":197,"endline":197,"start":7,"end":13},{"descr":"boolean","code":0,"path":"/Users/djpfahler/localhost/smile/node_modules/react-native/Libraries/ReactIOS/ReactIOSMount.js","line":194,"endline":194,"start":59,"end":62}]}],"version":" Apr 25 2015 04:11:34"}
jasongonzales23 commented 9 years ago

Bump. Using flow 0.10.0 as well. Same error as davidpfahler.

chris-alexander55 commented 9 years ago

Truthfully, I was able to move beyond this error by creating the AwesomeProject, confirmed that it compiled, then mutated it accordingly for my app build-out. It appears that the entire react-native stack is very, very fragile with dependencies literally changing every day. Once you get something working use NPM shrinkwrap feature to freeze those dependencies. May the force be with you!

[cid:053B7F2F-42CB-4748-92F7-05972DA8D049]

Christopher Alexander | Principle Software Engineer, Hook & Loop

641 Avenue of the Americas, New York, NY 10011 | office: 646 336 1700 |

christopher.alexander@infor.commailto:christopher.alexander@infor.com | http://www.infor.comhttp://www.infor.com/

From: Jason notifications@github.com<mailto:notifications@github.com> Reply-To: facebook/react-native reply@reply.github.com<mailto:reply@reply.github.com> Date: Saturday, April 25, 2015 at 12:16 PM To: facebook/react-native react-native@noreply.github.com<mailto:react-native@noreply.github.com> Cc: Christopher Alexander chris.alexander@infor.com<mailto:chris.alexander@infor.com> Subject: Re: [react-native] Flow Type Errors Examples/UIExplorer (#938)

Bump. Using flow 0.10.0 as well. Same error as davidpfahler.

— Reply to this email directly or view it on GitHubhttps://github.com/facebook/react-native/issues/938#issuecomment-96233027.

davidpfahler commented 9 years ago

@chris-alexander55 That is certainly sound advice, but shouldn't stop anyone from reporting issue when they occur.

jasongonzales23 commented 9 years ago

This fixed it for me:

In .flowconfig [libs] should be [library].

Carry on.

davidpfahler commented 9 years ago

@jasongonzales23

$ flow --json
Flow server launched for [...]
.flowconfig:23 Unsupported config section: "library"
Could not start flow server!
jasongonzales23 commented 9 years ago

Yeah, I see the same error in terminal, but miraculously the application launches and works. So yeah, my "solution" only works by coincidence :-1:

You could (and I did) put anything in there and the demo will subsequently run.

For reference, I tried the following:

[kittens] [pygmygoats] [ufos]

And all of them had the same result.

christopherdro commented 9 years ago

This looks like the same as #912 #784.

The issue is not upgrading flow. Trying using 0.7.0 , or 0.8.0.

jasongonzales23 commented 9 years ago

Ah, OK. Works now. This should either be fixed or documented then.

stephendeyoung commented 9 years ago

I'm having the same problem as @davidpfahler

I don't get any errors if I downgrade flow to 0.9.2.

rogeryangpro commented 9 years ago

same problem as @davidpfahler

nicklockwood commented 9 years ago

I've got it working in flow 0.10 by disabling flow in UIExplorerList.js, and switching a few types to "any" in the other files it complains about.

There were a couple of genuine type errors, but it looks like the others are either bugs in the flow analyser, or it's been confused by a knock-on issue from an imported file that my flow-fu isn't strong enough to diagnose.

gabelevi commented 9 years ago

Hi everyone, thanks for the reports and sorry that you guys are having trouble! I'm a member of the Flow team and we spent the last day looking into this issue. There are two problems being discussed in this issue, both regarding react-native and Flow having trouble working together. The two problems are:

  1. People are having trouble using react-native 0.4.0 with Flow v0.10.0
  2. People are experiencing other miscellaneous Flow errors

This evening we deployed react-native 0.4.1, which included the following changes:

  1. Fixed the issues that Flow v0.10.0 noticed. react-native init yourproject should no longer generate a project with Flow errors (according to Flow v0.10.0)
  2. Temporarily disabled the red-box error messages for Flow errors. Users will have to run flow manually to see Flow errors. We on the Flow team think react-native is pretty awesome and don't want to block anyone from trying it out while we figure out how to properly pin Flow versions to React.

Over the next week I'm going to try and tackle this problem of making sure that people use the right version of Flow with each version of react-native. Here are my tentative plans:

  1. Introduce an option to turn the flow checks on/off when you run your react-native app (and thus whether to show the red box)
  2. react-native init generates this .flowconfig file which configures Flow for your new project. I'm going to make the .flowconfig file specify exactly which version of Flow your project expects. That way if you're running the wrong version of Flow you'll know immediately, rather than having to guess from some strange error message
  3. I'm going to add flow-bin as a npm dependency. flow-bin is a pseudo npm package that downloads the correct binary from GitHub based on the version number and your operating system. This way the react-native packager can always use the correct version of Flow when doing it's Flow checking.

So yeah, sorry for the pain, thanks for the report, and look for some related improvements shortly!

gabelevi commented 9 years ago

Closing this issue out as a duplicate of https://github.com/facebook/react-native/issues/784