Running `flow` inside a brand new project fails #784

Closed
jergason opened this Issue Apr 9, 2015 · 41 comments

Comments

Projects
None yet
@jergason

jergason commented Apr 9, 2015

flowsad

Steps to reproduce:

  1. react-native init someproject && cd someproject
  2. flow init
  3. flow
  4. Cry because there are 438 errors.

I am on OS X 10.10.2, iojs 1.6.3, react-native 0.3.10, and flow 0.8.

Here is the JSON from the first few errors:

{
  "passed": false,
  "errors": [
    {
      "message": [
        {
          "descr": "NativeModules\nRequired module not found",
          "code": 0,
          "path": "/Users/jergason/code/flowbreaks/node_modules/react-native/Libraries/ActionSheetIOS/ActionSheetIOS.js",
          "line": 14,
          "endline": 14,
          "start": 29,
          "end": 52
        }
      ]
    },
    {
      "message": [
        {
          "descr": "invariant\nRequired module not found",
          "code": 0,
          "path": "/Users/jergason/code/flowbreaks/node_modules/react-native/Libraries/ActionSheetIOS/ActionSheetIOS.js",
          "line": 16,
          "endline": 16,
          "start": 17,
          "end": 36
        }
      ]
    },
    {
      "message": [
        {
          "descr": "NativeModules\nRequired module not found",
          "code": 0,
          "path": "/Users/jergason/code/flowbreaks/node_modules/react-native/Libraries/AdSupport/AdSupportIOS.js",
          "line": 14,
          "endline": 14,
          "start": 17,
          "end": 40
        }
      ]
    },
    {
      "message": [
        {
          "descr": "NativeModules\nRequired module not found",
          "code": 0,
          "path": "/Users/jergason/code/flowbreaks/node_modules/react-native/Libraries/Animation/AnimationExperimental.js",
          "line": 14,
          "endline": 14,
          "start": 27,
          "end": 50
        }
      ]
    },
    {
      "message": [
        {
          "descr": "AnimationUtils\nRequired module not found",
          "code": 0,
          "path": "/Users/jergason/code/flowbreaks/node_modules/react-native/Libraries/Animation/AnimationExperimental.js",
          "line": 15,
          "endline": 15,
          "start": 22,
          "end": 46
        }
      ]
    },
    {
      "message": [
        {
          "descr": "identifier __DEV__\nUnknown global name",
          "code": 0,
          "path": "/Users/jergason/code/flowbreaks/node_modules/react-native/Libraries/Animation/AnimationExperimental.js",
          "line": 75,
          "endline": 75,
          "start": 5,
          "end": 11
        }
      ]
    },
    {
      "message": [
        {
          "descr": "ReactPropTypes\nRequired module not found",
          "code": 0,
          "path": "/Users/jergason/code/flowbreaks/node_modules/react-native/Libraries/Animation/LayoutAnimation.js",
          "line": 14,
          "endline": 14,
          "start": 17,
          "end": 41
        }
      ]
    },
// etc
  ]
}
@frantic

This comment has been minimized.

Show comment
Hide comment
@frantic

frantic Apr 10, 2015

Contributor

We are going to provide a flowconfig with sample app soon. cc @sahrens

Contributor

frantic commented Apr 10, 2015

We are going to provide a flowconfig with sample app soon. cc @sahrens

@bhosmer

This comment has been minimized.

Show comment
Hide comment
@bhosmer

bhosmer Apr 10, 2015

Contributor

HI @jergason - so the problem is that flow init writes an empty .flowconfig into the root of the new project directory. (react-native init should instead write one that's set up properly, but per @frantic, that's not happening just yet.)

For now, the workaround is to copy the .flowconfig from the root of react-native into your project directory and tweak it, by replacing the two lines in the [library] section with this one:

node_modules/react-native/Libraries/react-native/react-native-interface.js

That should get you to 0 errors using Flow 0.8.0.

Contributor

bhosmer commented Apr 10, 2015

HI @jergason - so the problem is that flow init writes an empty .flowconfig into the root of the new project directory. (react-native init should instead write one that's set up properly, but per @frantic, that's not happening just yet.)

For now, the workaround is to copy the .flowconfig from the root of react-native into your project directory and tweak it, by replacing the two lines in the [library] section with this one:

node_modules/react-native/Libraries/react-native/react-native-interface.js

That should get you to 0 errors using Flow 0.8.0.

@sthomp

This comment has been minimized.

Show comment
Hide comment
@sthomp

sthomp Apr 18, 2015

Im still having issues getting flow to run without errors. After I react-native init hello I can see there is a .flowconfig provided. But when I run flow I see errors. Currently using flow 0.9.2.

{  
   "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: function call\nCallable signature not found in",
         "filename":"/Users/thompsons/Code/reactjs/hello/node_modules/react-native/Libraries/AppRegistry/AppRegistry.js",
         "lineNumber":57,
         "column":9
      },
      {  
         "description":"  E1: exports",
         "filename":"/Users/thompsons/Code/reactjs/hello/node_modules/react-native/Libraries/ReactIOS/renderApplication.ios.js",
         "lineNumber":0,
         "column":0
      },
      {  
         "description":"E2: \nFailure(\"internal error: package /Users/thompsons/node_modules/React/package.json not found\")",
         "filename":"/Users/thompsons/Code/reactjs/hello/node_modules/react-native/Libraries/Components/ActivityIndicatorIOS/ActivityIndicatorIOS.ios.js",
         "lineNumber":0,
         "column":0
      },
      {  
         "description":"E3: \nFailure(\"internal error: package /Users/thompsons/node_modules/React/package.json not found\")",
         "filename":"/Users/thompsons/Code/reactjs/hello/node_modules/react-native/Libraries/Components/DatePicker/DatePickerIOS.ios.js",
         "lineNumber":0,
         "column":0
      },
      {  
         "description":"E4: \nFailure(\"internal error: package /Users/thompsons/node_modules/React/package.json not found\")",
         "filename":"/Users/thompsons/Code/reactjs/hello/node_modules/react-native/Libraries/Components/MapView/MapView.js",
         "lineNumber":0,
         "column":0
      },
      {  
         "description":"E5: \nFailure(\"internal error: package /Users/thompsons/node_modules/React/package.json not found\")",
         "filename":"/Users/thompsons/Code/reactjs/hello/node_modules/react-native/Libraries/Components/Navigation/NavigatorIOS.ios.js",
         "lineNumber":0,
         "column":0
      },
      {  
         "description":"E6: \nFailure(\"internal error: package /Users/thompsons/node_modules/React/package.json not found\")",
         "filename":"/Users/thompsons/Code/reactjs/hello/node_modules/react-native/Libraries/Components/ScrollView/ScrollView.js",
         "lineNumber":0,
         "column":0
      },
      {  
         "description":"E7: \nFailure(\"internal error: package /Users/thompsons/node_modules/React/package.json not found\")",
         "filename":"/Users/thompsons/Code/reactjs/hello/node_modules/react-native/Libraries/Components/SliderIOS/SliderIOS.js",
         "lineNumber":0,
         "column":0
      },
      {  
         "description":"E8: \nFailure(\"internal error: package /Users/thompsons/node_modules/React/package.json not found\")",
         "filename":"/Users/thompsons/Code/reactjs/hello/node_modules/react-native/Libraries/Components/StaticRenderer.js",
         "lineNumber":0,
         "column":0
      },
      {  
         "description":"E9: \nFailure(\"internal error: package /Users/thompsons/node_modules/React/package.json not found\")",
         "filename":"/Users/thompsons/Code/reactjs/hello/node_modules/react-native/Libraries/Components/SwitchIOS/SwitchIOS.ios.js",
         "lineNumber":0,
         "column":0
      },
      {  
         "description":"E10: \nFailure(\"internal error: package /Users/thompsons/node_modules/React/package.json not found\")",
         "filename":"/Users/thompsons/Code/reactjs/hello/node_modules/react-native/Libraries/Components/TabBarIOS/TabBarIOS.ios.js",
         "lineNumber":0,
         "column":0
      },
      {  
         "description":"E11: \nFailure(\"internal error: package /Users/thompsons/node_modules/React/package.json not found\")",
         "filename":"/Users/thompsons/Code/reactjs/hello/node_modules/react-native/Libraries/Components/TabBarIOS/TabBarItemIOS.ios.js",
         "lineNumber":0,
         "column":0
      },
      {  
         "description":"E12: \nFailure(\"internal error: package /Users/thompsons/node_modules/React/package.json not found\")",
         "filename":"/Users/thompsons/Code/reactjs/hello/node_modules/react-native/Libraries/Components/TextInput/TextInput.js",
         "lineNumber":0,
         "column":0
      },
      {  
         "description":"E13: \nFailure(\"internal error: package /Users/thompsons/node_modules/React/package.json not found\")",
         "filename":"/Users/thompsons/Code/reactjs/hello/node_modules/react-native/Libraries/Components/Touchable/TouchableBounce.js",
         "lineNumber":0,
         "column":0
      },
      {  
         "description":"E14: \nFailure(\"internal error: package /Users/thompsons/node_modules/React/package.json not found\")",
         "filename":"/Users/thompsons/Code/reactjs/hello/node_modules/react-native/Libraries/Components/Touchable/TouchableWithoutFeedback.js",
         "lineNumber":0,
         "column":0
      },
      {  
         "description":"E15: \nFailure(\"internal error: package /Users/thompsons/node_modules/React/package.json not found\")",
         "filename":"/Users/thompsons/Code/reactjs/hello/node_modules/react-native/Libraries/Components/View/View.js",
         "lineNumber":0,
         "column":0
      },
      {  
         "description":"E16: \nFailure(\"internal error: package /Users/thompsons/node_modules/React/package.json not found\")",
         "filename":"/Users/thompsons/Code/reactjs/hello/node_modules/react-native/Libraries/Components/WebView/WebView.ios.js",
         "lineNumber":0,
         "column":0
      },
      {  
         "description":"E17: \nFailure(\"internal error: package /Users/thompsons/node_modules/React/package.json not found\")",
         "filename":"/Users/thompsons/Code/reactjs/hello/node_modules/react-native/Libraries/Image/Image.ios.js",
         "lineNumber":0,
         "column":0
      },
      {  
         "description":"E18: \nFailure(\"internal error: package /Users/thompsons/node_modules/React/package.json not found\")",
         "filename":"/Users/thompsons/Code/reactjs/hello/node_modules/react-native/Libraries/ReactIOS/renderApplication.ios.js",
         "lineNumber":0,
         "column":0
      },
      {  
         "description":"E19: property propTypes\nProperty not found in",
         "filename":"/Users/thompsons/Code/reactjs/hello/node_modules/react-native/Libraries/ReactIOS/verifyPropTypes.js",
         "lineNumber":28,
         "column":10
      },
      {  
         "description":"  E19: exports",
         "filename":"/Users/thompsons/Code/reactjs/hello/node_modules/react-native/Libraries/Components/View/View.js",
         "lineNumber":0,
         "column":0
      },
      {  
         "description":"E20: \nFailure(\"internal error: package /Users/thompsons/node_modules/React/package.json not found\")",
         "filename":"/Users/thompsons/Code/reactjs/hello/node_modules/react-native/Libraries/Text/Text.js",
         "lineNumber":0,
         "column":0
      },
      {  
         "description":"E21: \nFailure(\"internal error: package /Users/thompsons/node_modules/React/package.json not found\")",
         "filename":"/Users/thompsons/Code/reactjs/hello/node_modules/react-native/Libraries/react-native/react-native.js",
         "lineNumber":0,
         "column":0
      }
   ]
}

sthomp commented Apr 18, 2015

Im still having issues getting flow to run without errors. After I react-native init hello I can see there is a .flowconfig provided. But when I run flow I see errors. Currently using flow 0.9.2.

{  
   "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: function call\nCallable signature not found in",
         "filename":"/Users/thompsons/Code/reactjs/hello/node_modules/react-native/Libraries/AppRegistry/AppRegistry.js",
         "lineNumber":57,
         "column":9
      },
      {  
         "description":"  E1: exports",
         "filename":"/Users/thompsons/Code/reactjs/hello/node_modules/react-native/Libraries/ReactIOS/renderApplication.ios.js",
         "lineNumber":0,
         "column":0
      },
      {  
         "description":"E2: \nFailure(\"internal error: package /Users/thompsons/node_modules/React/package.json not found\")",
         "filename":"/Users/thompsons/Code/reactjs/hello/node_modules/react-native/Libraries/Components/ActivityIndicatorIOS/ActivityIndicatorIOS.ios.js",
         "lineNumber":0,
         "column":0
      },
      {  
         "description":"E3: \nFailure(\"internal error: package /Users/thompsons/node_modules/React/package.json not found\")",
         "filename":"/Users/thompsons/Code/reactjs/hello/node_modules/react-native/Libraries/Components/DatePicker/DatePickerIOS.ios.js",
         "lineNumber":0,
         "column":0
      },
      {  
         "description":"E4: \nFailure(\"internal error: package /Users/thompsons/node_modules/React/package.json not found\")",
         "filename":"/Users/thompsons/Code/reactjs/hello/node_modules/react-native/Libraries/Components/MapView/MapView.js",
         "lineNumber":0,
         "column":0
      },
      {  
         "description":"E5: \nFailure(\"internal error: package /Users/thompsons/node_modules/React/package.json not found\")",
         "filename":"/Users/thompsons/Code/reactjs/hello/node_modules/react-native/Libraries/Components/Navigation/NavigatorIOS.ios.js",
         "lineNumber":0,
         "column":0
      },
      {  
         "description":"E6: \nFailure(\"internal error: package /Users/thompsons/node_modules/React/package.json not found\")",
         "filename":"/Users/thompsons/Code/reactjs/hello/node_modules/react-native/Libraries/Components/ScrollView/ScrollView.js",
         "lineNumber":0,
         "column":0
      },
      {  
         "description":"E7: \nFailure(\"internal error: package /Users/thompsons/node_modules/React/package.json not found\")",
         "filename":"/Users/thompsons/Code/reactjs/hello/node_modules/react-native/Libraries/Components/SliderIOS/SliderIOS.js",
         "lineNumber":0,
         "column":0
      },
      {  
         "description":"E8: \nFailure(\"internal error: package /Users/thompsons/node_modules/React/package.json not found\")",
         "filename":"/Users/thompsons/Code/reactjs/hello/node_modules/react-native/Libraries/Components/StaticRenderer.js",
         "lineNumber":0,
         "column":0
      },
      {  
         "description":"E9: \nFailure(\"internal error: package /Users/thompsons/node_modules/React/package.json not found\")",
         "filename":"/Users/thompsons/Code/reactjs/hello/node_modules/react-native/Libraries/Components/SwitchIOS/SwitchIOS.ios.js",
         "lineNumber":0,
         "column":0
      },
      {  
         "description":"E10: \nFailure(\"internal error: package /Users/thompsons/node_modules/React/package.json not found\")",
         "filename":"/Users/thompsons/Code/reactjs/hello/node_modules/react-native/Libraries/Components/TabBarIOS/TabBarIOS.ios.js",
         "lineNumber":0,
         "column":0
      },
      {  
         "description":"E11: \nFailure(\"internal error: package /Users/thompsons/node_modules/React/package.json not found\")",
         "filename":"/Users/thompsons/Code/reactjs/hello/node_modules/react-native/Libraries/Components/TabBarIOS/TabBarItemIOS.ios.js",
         "lineNumber":0,
         "column":0
      },
      {  
         "description":"E12: \nFailure(\"internal error: package /Users/thompsons/node_modules/React/package.json not found\")",
         "filename":"/Users/thompsons/Code/reactjs/hello/node_modules/react-native/Libraries/Components/TextInput/TextInput.js",
         "lineNumber":0,
         "column":0
      },
      {  
         "description":"E13: \nFailure(\"internal error: package /Users/thompsons/node_modules/React/package.json not found\")",
         "filename":"/Users/thompsons/Code/reactjs/hello/node_modules/react-native/Libraries/Components/Touchable/TouchableBounce.js",
         "lineNumber":0,
         "column":0
      },
      {  
         "description":"E14: \nFailure(\"internal error: package /Users/thompsons/node_modules/React/package.json not found\")",
         "filename":"/Users/thompsons/Code/reactjs/hello/node_modules/react-native/Libraries/Components/Touchable/TouchableWithoutFeedback.js",
         "lineNumber":0,
         "column":0
      },
      {  
         "description":"E15: \nFailure(\"internal error: package /Users/thompsons/node_modules/React/package.json not found\")",
         "filename":"/Users/thompsons/Code/reactjs/hello/node_modules/react-native/Libraries/Components/View/View.js",
         "lineNumber":0,
         "column":0
      },
      {  
         "description":"E16: \nFailure(\"internal error: package /Users/thompsons/node_modules/React/package.json not found\")",
         "filename":"/Users/thompsons/Code/reactjs/hello/node_modules/react-native/Libraries/Components/WebView/WebView.ios.js",
         "lineNumber":0,
         "column":0
      },
      {  
         "description":"E17: \nFailure(\"internal error: package /Users/thompsons/node_modules/React/package.json not found\")",
         "filename":"/Users/thompsons/Code/reactjs/hello/node_modules/react-native/Libraries/Image/Image.ios.js",
         "lineNumber":0,
         "column":0
      },
      {  
         "description":"E18: \nFailure(\"internal error: package /Users/thompsons/node_modules/React/package.json not found\")",
         "filename":"/Users/thompsons/Code/reactjs/hello/node_modules/react-native/Libraries/ReactIOS/renderApplication.ios.js",
         "lineNumber":0,
         "column":0
      },
      {  
         "description":"E19: property propTypes\nProperty not found in",
         "filename":"/Users/thompsons/Code/reactjs/hello/node_modules/react-native/Libraries/ReactIOS/verifyPropTypes.js",
         "lineNumber":28,
         "column":10
      },
      {  
         "description":"  E19: exports",
         "filename":"/Users/thompsons/Code/reactjs/hello/node_modules/react-native/Libraries/Components/View/View.js",
         "lineNumber":0,
         "column":0
      },
      {  
         "description":"E20: \nFailure(\"internal error: package /Users/thompsons/node_modules/React/package.json not found\")",
         "filename":"/Users/thompsons/Code/reactjs/hello/node_modules/react-native/Libraries/Text/Text.js",
         "lineNumber":0,
         "column":0
      },
      {  
         "description":"E21: \nFailure(\"internal error: package /Users/thompsons/node_modules/React/package.json not found\")",
         "filename":"/Users/thompsons/Code/reactjs/hello/node_modules/react-native/Libraries/react-native/react-native.js",
         "lineNumber":0,
         "column":0
      }
   ]
}
@jergason

This comment has been minimized.

Show comment
Hide comment
@jergason

jergason Apr 18, 2015

The default .flowconfig file isn't correct. See #784 (comment) for an explanation of how to get it running.

The default .flowconfig file isn't correct. See #784 (comment) for an explanation of how to get it running.

@sthomp

This comment has been minimized.

Show comment
Hide comment
@sthomp

sthomp Apr 19, 2015

Here is the .flowconfig that react-native generated which matches the comments above:

[ignore]

# We fork some components by platform.
.*/*.web.js
.*/*.android.js

# Some modules have their own node_modules with overlap
.*/node_modules/node-haste/.*

# Ignore react-tools where there are overlaps, but don't ignore anything that
# react-native relies on
.*/node_modules/react-tools/src/vendor/core/ExecutionEnvironment.js
.*/node_modules/react-tools/src/browser/eventPlugins/ResponderEventPlugin.js
.*/node_modules/react-tools/src/browser/ui/React.js
.*/node_modules/react-tools/src/core/ReactInstanceHandles.js
.*/node_modules/react-tools/src/event/EventPropagators.js

# Ignore jest
.*/react-native/node_modules/jest-cli/.*

[include]

[libs]
node_modules/react-native/Libraries/react-native/react-native-interface.js

[options]
module.system=haste

sthomp commented Apr 19, 2015

Here is the .flowconfig that react-native generated which matches the comments above:

[ignore]

# We fork some components by platform.
.*/*.web.js
.*/*.android.js

# Some modules have their own node_modules with overlap
.*/node_modules/node-haste/.*

# Ignore react-tools where there are overlaps, but don't ignore anything that
# react-native relies on
.*/node_modules/react-tools/src/vendor/core/ExecutionEnvironment.js
.*/node_modules/react-tools/src/browser/eventPlugins/ResponderEventPlugin.js
.*/node_modules/react-tools/src/browser/ui/React.js
.*/node_modules/react-tools/src/core/ReactInstanceHandles.js
.*/node_modules/react-tools/src/event/EventPropagators.js

# Ignore jest
.*/react-native/node_modules/jest-cli/.*

[include]

[libs]
node_modules/react-native/Libraries/react-native/react-native-interface.js

[options]
module.system=haste
@jasongonzales23

This comment has been minimized.

Show comment
Hide comment
@jasongonzales23

jasongonzales23 Apr 25, 2015

Bump. Same issue. Using Flow 0.10.0

Bump. Same issue. Using Flow 0.10.0

@jasongonzales23

This comment has been minimized.

Show comment
Hide comment
@jasongonzales23

jasongonzales23 Apr 25, 2015

uh, wow, I fixed it...?

[libs] should be [library]

Seems like a simple bugfix. Maybe I will dig in to this and fix it?

uh, wow, I fixed it...?

[libs] should be [library]

Seems like a simple bugfix. Maybe I will dig in to this and fix it?

@christopherdro

This comment has been minimized.

Show comment
Hide comment
@christopherdro

christopherdro Apr 25, 2015

Contributor

That results in the flow server not being able start.
.flowconfig:23 Unsupported config section: "library"

Contributor

christopherdro commented Apr 25, 2015

That results in the flow server not being able start.
.flowconfig:23 Unsupported config section: "library"

@jasongonzales23

This comment has been minimized.

Show comment
Hide comment
@jasongonzales23

jasongonzales23 Apr 25, 2015

Heh, yeah I noticed that too late. All I noticed was that the demo then worked, which I assume is because flow didn't run at all. So, I still don't know how to get flow working in this demo.

But for fun you could try the following instead of [libs]

[kittens]
[pygmygoats]
[ufos]

and they all have the same result!

Heh, yeah I noticed that too late. All I noticed was that the demo then worked, which I assume is because flow didn't run at all. So, I still don't know how to get flow working in this demo.

But for fun you could try the following instead of [libs]

[kittens]
[pygmygoats]
[ufos]

and they all have the same result!

@christopherdro

This comment has been minimized.

Show comment
Hide comment
@christopherdro

christopherdro Apr 25, 2015

Contributor

This looks like the same as #912 #938.

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

Contributor

christopherdro commented Apr 25, 2015

This looks like the same as #912 #938.

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

@pavelnikolov

This comment has been minimized.

Show comment
Hide comment
@pavelnikolov

pavelnikolov Apr 26, 2015

What is the best way to downgrade flow if I have version 0.10.0 installed with homebrew?

What is the best way to downgrade flow if I have version 0.10.0 installed with homebrew?

@christopherdro

This comment has been minimized.

Show comment
Hide comment
@christopherdro

christopherdro Apr 26, 2015

Contributor

brew switch flow 0.8.0

If you don't have this version it will display what versions you have access to.

Contributor

christopherdro commented Apr 26, 2015

brew switch flow 0.8.0

If you don't have this version it will display what versions you have access to.

@jasongonzales23

This comment has been minimized.

Show comment
Hide comment
@jasongonzales23

jasongonzales23 Apr 26, 2015

No joy with 0.9.2, 0.8.0, 0.7.0.

No joy with 0.9.2, 0.8.0, 0.7.0.

@christopherdro

This comment has been minimized.

Show comment
Hide comment
@christopherdro

christopherdro Apr 27, 2015

Contributor

@jasongonzales23 After downgrading flow make sure to cd into your proj directory then try restarting the flow server by using 'flow stop' and 'flow start'.

See if that helps.

@jergason Did you resolve this issue?

Contributor

christopherdro commented Apr 27, 2015

@jasongonzales23 After downgrading flow make sure to cd into your proj directory then try restarting the flow server by using 'flow stop' and 'flow start'.

See if that helps.

@jergason Did you resolve this issue?

@princeli

This comment has been minimized.

Show comment
Hide comment
@princeli

princeli Apr 28, 2015

@jasongonzales23 thanks,it fix my error

@jasongonzales23 thanks,it fix my error

@gabelevi

This comment has been minimized.

Show comment
Hide comment
@gabelevi

gabelevi Apr 28, 2015

Contributor

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!

Contributor

gabelevi commented Apr 28, 2015

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!

@brentvatne

This comment has been minimized.

Show comment
Hide comment
@brentvatne

brentvatne Apr 28, 2015

Collaborator

Thanks @gabelevi! Your plan sounds good to me 👍

Collaborator

brentvatne commented Apr 28, 2015

Thanks @gabelevi! Your plan sounds good to me 👍

@watsonwu9

This comment has been minimized.

Show comment
Hide comment
@watsonwu9

watsonwu9 Apr 30, 2015

@christopherdro that fixed my error. thanks!

@christopherdro that fixed my error. thanks!

@watsonwu9

This comment has been minimized.

Show comment
Hide comment
@watsonwu9

watsonwu9 Apr 30, 2015

@jasongonzales23 fixed my problem. thx

@jasongonzales23 fixed my problem. thx

@christopherdro

This comment has been minimized.

Show comment
Hide comment
@christopherdro

christopherdro Apr 30, 2015

Contributor

@jergason Please close this issue since it has been resolved.
Thanks @gabelevi!

Contributor

christopherdro commented Apr 30, 2015

@jergason Please close this issue since it has been resolved.
Thanks @gabelevi!

@jergason jergason closed this Apr 30, 2015

@ajwhite

This comment has been minimized.

Show comment
Hide comment
@ajwhite

ajwhite Dec 23, 2015

Contributor

This appears to have become an issue again on 0.17.0 of RN.

The .flowconfig requires flow at 0.19.0, which I have installed, yet it fails to resolve any react native modules:

screen shot 2015-12-23 at 11 36 25 am

This can be reproduced on a fresh project.

Contributor

ajwhite commented Dec 23, 2015

This appears to have become an issue again on 0.17.0 of RN.

The .flowconfig requires flow at 0.19.0, which I have installed, yet it fails to resolve any react native modules:

screen shot 2015-12-23 at 11 36 25 am

This can be reproduced on a fresh project.

@satya164 satya164 reopened this Dec 23, 2015

@mcz

This comment has been minimized.

Show comment
Hide comment

mcz commented Dec 31, 2015

+1

@brenmcnamara

This comment has been minimized.

Show comment
Hide comment

+1

@ajwhite

This comment has been minimized.

Show comment
Hide comment
@ajwhite

ajwhite Jan 3, 2016

Contributor

I feel like I have nowhere to start with using Flow right now. Has anyone got an RN project running with Flow?

Contributor

ajwhite commented Jan 3, 2016

I feel like I have nowhere to start with using Flow right now. Has anyone got an RN project running with Flow?

@brentvatne

This comment has been minimized.

Show comment
Hide comment
@brentvatne

brentvatne Jan 3, 2016

Collaborator

cc @vjeux ^

Collaborator

brentvatne commented Jan 3, 2016

cc @vjeux ^

@vjeux

This comment has been minimized.

Show comment
Hide comment
@vjeux

vjeux Jan 3, 2016

Contributor

@gabelevi is the right person to talk to about flow :)

Contributor

vjeux commented Jan 3, 2016

@gabelevi is the right person to talk to about flow :)

@satya164

This comment has been minimized.

Show comment
Hide comment
@satya164

satya164 Jan 3, 2016

Collaborator

@gabelevi Lemme know if you need help with testing this. I've a project already setup with flow.

Collaborator

satya164 commented Jan 3, 2016

@gabelevi Lemme know if you need help with testing this. I've a project already setup with flow.

@artyomtrityak

This comment has been minimized.

Show comment
Hide comment
@artyomtrityak

artyomtrityak Jan 16, 2016

Contributor

+1, it looks like flow just does not work with RN from the box right now, any suggestions how to fix this?
All errors i see are related to require('NativeModules')

Contributor

artyomtrityak commented Jan 16, 2016

+1, it looks like flow just does not work with RN from the box right now, any suggestions how to fix this?
All errors i see are related to require('NativeModules')

@artyomtrityak

This comment has been minimized.

Show comment
Hide comment
@artyomtrityak

artyomtrityak Jan 16, 2016

Contributor

There is one solution i can propose to fix this issue - it is possible to create interface file for react-native and ExecutionEnvironment.

interfaces/react-native.js

declare module "react-native" {
  declare var exports: (callback: any) => any;
}

declare module ExecutionEnvironment {
  declare var exports: (callback: any) => any; 
}

and add to .flowconfig

[libs]
interfaces/
....
[ignore]
.*/node_modules/react-native/.*
....

[version]
0.20.1

This works for me right now, i can create pull request to update yeoman generator

Contributor

artyomtrityak commented Jan 16, 2016

There is one solution i can propose to fix this issue - it is possible to create interface file for react-native and ExecutionEnvironment.

interfaces/react-native.js

declare module "react-native" {
  declare var exports: (callback: any) => any;
}

declare module ExecutionEnvironment {
  declare var exports: (callback: any) => any; 
}

and add to .flowconfig

[libs]
interfaces/
....
[ignore]
.*/node_modules/react-native/.*
....

[version]
0.20.1

This works for me right now, i can create pull request to update yeoman generator

@Emilios1995

This comment has been minimized.

Show comment
Hide comment
@Emilios1995

Emilios1995 Feb 28, 2016

Contributor

👍
I would love complete support out of the box. Right now I get the following out of a new project
screen shot 2016-02-28 at 12 31 07 am

Contributor

Emilios1995 commented Feb 28, 2016

👍
I would love complete support out of the box. Right now I get the following out of a new project
screen shot 2016-02-28 at 12 31 07 am

@ajwhite

This comment has been minimized.

Show comment
Hide comment
@ajwhite

ajwhite Feb 28, 2016

Contributor

This seems to be working for 0.21.0-rc on a fresh project. What version of RN is that @Emilios1995?

Contributor

ajwhite commented Feb 28, 2016

This seems to be working for 0.21.0-rc on a fresh project. What version of RN is that @Emilios1995?

@cupofjoakim

This comment has been minimized.

Show comment
Hide comment
@cupofjoakim

cupofjoakim Jul 13, 2016

Also on a pretty new project over here, getting 19 errors from running 'flow'.
RN @ 0.29.0
flow-bin @ 0.28.0

Here's the output

cupofjoakim commented Jul 13, 2016

Also on a pretty new project over here, getting 19 errors from running 'flow'.
RN @ 0.29.0
flow-bin @ 0.28.0

Here's the output

@phil-travelbytes

This comment has been minimized.

Show comment
Hide comment
@phil-travelbytes

phil-travelbytes Jul 15, 2016

+1 (agree with cupofjoakim, have issue with default project seed)

+1 (agree with cupofjoakim, have issue with default project seed)

@luiswdy

This comment has been minimized.

Show comment
Hide comment
@luiswdy

luiswdy Jul 20, 2016

+1. I got as same issue as the one cupofjoakim reported.

luiswdy commented Jul 20, 2016

+1. I got as same issue as the one cupofjoakim reported.

@phil-travelbytes

This comment has been minimized.

Show comment
Hide comment
@phil-travelbytes

phil-travelbytes Jul 20, 2016

The 'init' project creates a .flowconfig which specifies [version] 0.27.0 - which works according to Michael Helvey in this stackoverflow post.

The actual issue for me is that flow binaries are not available in brew for back sourcing. I have flow version 0.23.1 and now 0.28, and 0.29.

brew upgrade flow --version 0.27.0
Error: No available formula with the name "0.27.0"

If these were available it would be simple to regress flow to the correct version, and then happy days :)

The 'init' project creates a .flowconfig which specifies [version] 0.27.0 - which works according to Michael Helvey in this stackoverflow post.

The actual issue for me is that flow binaries are not available in brew for back sourcing. I have flow version 0.23.1 and now 0.28, and 0.29.

brew upgrade flow --version 0.27.0
Error: No available formula with the name "0.27.0"

If these were available it would be simple to regress flow to the correct version, and then happy days :)

@satya164

This comment has been minimized.

Show comment
Hide comment
@satya164

satya164 Jul 20, 2016

Collaborator

@phil-travelbytes

npm install flow-bin@0.27.0
Collaborator

satya164 commented Jul 20, 2016

@phil-travelbytes

npm install flow-bin@0.27.0
@phil-travelbytes

This comment has been minimized.

Show comment
Hide comment
@phil-travelbytes

phil-travelbytes Jul 22, 2016

@satya164 thank you!
Works a treat running via <PROJECT_ROOT>/node_modules/.bin/flow ...

but how do I include it in Nuclide?

@satya164 thank you!
Works a treat running via <PROJECT_ROOT>/node_modules/.bin/flow ...

but how do I include it in Nuclide?

@satya164

This comment has been minimized.

Show comment
Hide comment
@satya164

satya164 Jul 22, 2016

Collaborator

Nuclide doesn't support it yet. But support is coming - https://twitter.com/natmote/status/755871913864466433

Collaborator

satya164 commented Jul 22, 2016

Nuclide doesn't support it yet. But support is coming - https://twitter.com/natmote/status/755871913864466433

@justin808

This comment has been minimized.

Show comment
Hide comment
@justin808

justin808 Jul 25, 2016

Any recommendations if flow should be a dev dependency of a react-native project? I'm guessing yes, since the eslint version very sensitive.

Any recommendations if flow should be a dev dependency of a react-native project? I'm guessing yes, since the eslint version very sensitive.

@mt81

This comment has been minimized.

Show comment
Hide comment

mt81 commented Aug 3, 2016

+1

@hramos

This comment has been minimized.

Show comment
Hide comment
@hramos

hramos Nov 1, 2016

Contributor

Looks like this can be closed as well (see #8773).

Contributor

hramos commented Nov 1, 2016

Looks like this can be closed as well (see #8773).

@hramos hramos closed this Nov 1, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment