簡體   English   中英

設置React Native和Flow-獲取Native Base錯誤

[英]Setting up React Native and Flow - Getting Native Base errors

我遵循了Flow網站和網站上的教程 當我到達這一步時:

npm run flow

它返回了許多錯誤,最后看起來它報告了一個失敗的過程。

> CGPSApp@0.0.1 flow /Users/agerson/Desktop/CGPSApp
> flow


Launching Flow server for /Users/agerson/Desktop/CGPSApp
Spawned flow server (pid=94474)
Logs will go to /private/tmp/flow/zSUserszSagersonzSDesktopzSCGPSApp.log
node_modules/native-base/node_modules/react-native-vector-icons/lib/generate-icon-set-from-css.js:0
generateIconSetFromCss. Duplicate module provider
current provider. See: ../../.nvm/versions/node/v4.8.2/lib/node_modules/react-native-vector-icons/lib/generate-icon-set-from-css.js:0

node_modules/native-base/src/backward/Widgets/Button.js:89
 89:         ref={(c) => { this._root = c; }}
                                ^^^^^ property `_root`. Property not found in
 89:         ref={(c) => { this._root = c; }}
                           ^^^^ Button

node_modules/native-base/src/backward/Widgets/Card.js:32
 32:       <View ref={c => this._root = c} {...this.props} >
                                ^^^^^ property `_root`. Property not found in
 32:       <View ref={c => this._root = c} {...this.props} >
                           ^^^^ Card

node_modules/native-base/src/backward/Widgets/CardItem.js:195
195:         ref={(c) => { this._root = c; }} {...this.prepareRootProps()}
                                ^^^^^ property `_root`. Property not found in
195:         ref={(c) => { this._root = c; }} {...this.prepareRootProps()}
                           ^^^^ CardItem1

node_modules/native-base/src/backward/Widgets/CardSwiper.js:7
  7: import { View } from './View';
              ^^^^ Named import from module `./View`. This module has no named export called `View`.

node_modules/native-base/src/backward/Widgets/CardSwiper.js:14
 14:   constructor(props) {
                   ^^^^^ parameter `props`. Missing annotation

node_modules/native-base/src/backward/Widgets/CardSwiper.js:16
 16:     this.state = {
                      ^ object literal. This type is incompatible with
  6: export default class NativeBaseComponent extends Component {
                                                      ^^^^^^^^^ undefined. Did you forget to declare type parameter `State` of identifier `Component`?. See: node_modules/native-base/src/backward/Base/NativeBaseComponent.js:6

node_modules/native-base/src/backward/Widgets/CardSwiper.js:28
 28:             this.state.enter,
                            ^^^^^ property `enter`. Property cannot be accessed on possibly undefined value
 28:             this.state.enter,
                 ^^^^^^^^^^ undefined. Did you forget to declare type parameter `State` of identifier `Component`?

node_modules/native-base/src/backward/Widgets/CardSwiper.js:34
 34:     this._panResponder = PanResponder.create({
              ^^^^^^^^^^^^^ property `_panResponder`. Property not found in
 34:     this._panResponder = PanResponder.create({
         ^^^^ CardSwiper

node_modules/native-base/src/backward/Widgets/CardSwiper.js:39
 39:         this.state.pan.setOffset({ x: this.state.pan.x._value, y: this.state.pan.y._value });
                        ^^^ property `pan`. Property cannot be accessed on possibly undefined value
 39:         this.state.pan.setOffset({ x: this.state.pan.x._value, y: this.state.pan.y._value });
             ^^^^^^^^^^ undefined. Did you forget to declare type parameter `State` of identifier `Component`?

node_modules/native-base/src/backward/Widgets/CardSwiper.js:39
 39:         this.state.pan.setOffset({ x: this.state.pan.x._value, y: this.state.pan.y._value });
                                                      ^^^ property `pan`. Property cannot be accessed on possibly undefined value
 39:         this.state.pan.setOffset({ x: this.state.pan.x._value, y: this.state.pan.y._value });
                                           ^^^^^^^^^^ undefined. Did you forget to declare type parameter `State` of identifier `Component`?

node_modules/native-base/src/backward/Widgets/CardSwiper.js:39
 39:         this.state.pan.setOffset({ x: this.state.pan.x._value, y: this.state.pan.y._value });
                                                                                  ^^^ property `pan`. Property cannot be accessed on possibly undefined value
 39:         this.state.pan.setOffset({ x: this.state.pan.x._value, y: this.state.pan.y._value });
                                                                       ^^^^^^^^^^ undefined. Did you forget to declare type parameter `State` of identifier `Component`?

node_modules/native-base/src/backward/Widgets/CardSwiper.js:40
 40:         this.state.pan.setValue({ x: 0, y: 0 });
                        ^^^ property `pan`. Property cannot be accessed on possibly undefined value
 40:         this.state.pan.setValue({ x: 0, y: 0 });
             ^^^^^^^^^^ undefined. Did you forget to declare type parameter `State` of identifier `Component`?

node_modules/native-base/src/backward/Widgets/CardSwiper.js:44
 44:         null, { dx: this.state.pan.x, dy: this.state.pan.y },
                                    ^^^ property `pan`. Property cannot be accessed on possibly undefined value
 44:         null, { dx: this.state.pan.x, dy: this.state.pan.y },
                         ^^^^^^^^^^ undefined. Did you forget to declare type parameter `State` of identifier `Component`?

node_modules/native-base/src/backward/Widgets/CardSwiper.js:44
 44:         null, { dx: this.state.pan.x, dy: this.state.pan.y },
                                                          ^^^ property `pan`. Property cannot be accessed on possibly undefined value
 44:         null, { dx: this.state.pan.x, dy: this.state.pan.y },
                                               ^^^^^^^^^^ undefined. Did you forget to declare type parameter `State` of identifier `Component`?

node_modules/native-base/src/backward/Widgets/CardSwiper.js:48
 48:         this.state.pan.flattenOffset();
                        ^^^ property `pan`. Property cannot be accessed on possibly undefined value
 48:         this.state.pan.flattenOffset();
             ^^^^^^^^^^ undefined. Did you forget to declare type parameter `State` of identifier `Component`?

node_modules/native-base/src/backward/Widgets/CardSwiper.js:57
 57:         if (Math.abs(this.state.pan.x._value) > SWIPE_THRESHOLD) {
                                     ^^^ property `pan`. Property cannot be accessed on possibly undefined value
 57:         if (Math.abs(this.state.pan.x._value) > SWIPE_THRESHOLD) {
                          ^^^^^^^^^^ undefined. Did you forget to declare type parameter `State` of identifier `Component`?

node_modules/native-base/src/backward/Widgets/CardSwiper.js:58
 58:           if (velocity > 0) {
                   ^^^^^^^^ possibly uninitialized variable. This type cannot be compared to
 58:           if (velocity > 0) {
                              ^ number

node_modules/native-base/src/backward/Widgets/CardSwiper.js:63
 63:           Animated.decay(this.state.pan, {
                                         ^^^ property `pan`. Property cannot be accessed on possibly undefined value
 63:           Animated.decay(this.state.pan, {
                              ^^^^^^^^^^ undefined. Did you forget to declare type parameter `State` of identifier `Component`?

node_modules/native-base/src/backward/Widgets/CardSwiper.js:68
 68:           Animated.spring(this.state.pan, {
                                          ^^^ property `pan`. Property cannot be accessed on possibly undefined value
 68:           Animated.spring(this.state.pan, {
                               ^^^^^^^^^^ undefined. Did you forget to declare type parameter `State` of identifier `Component`?

node_modules/native-base/src/backward/Widgets/CardSwiper.js:78
 78:     this.state.pan.setValue({ x: 0, y: 0 });
                    ^^^ property `pan`. Property cannot be accessed on possibly undefined value
 78:     this.state.pan.setValue({ x: 0, y: 0 });
         ^^^^^^^^^^ undefined. Did you forget to declare type parameter `State` of identifier `Component`?

node_modules/native-base/src/backward/Widgets/CardSwiper.js:79
 79:     this.state.enter.setValue(0);
                    ^^^^^ property `enter`. Property cannot be accessed on possibly undefined value
 79:     this.state.enter.setValue(0);
         ^^^^^^^^^^ undefined. Did you forget to declare type parameter `State` of identifier `Component`?

node_modules/native-base/src/backward/Widgets/CardSwiper.js:84
 84:     const { pan, enter } = this.state;
                 ^^^ property `pan`. Property cannot be accessed on possibly undefined value
 84:     const { pan, enter } = this.state;
                                ^^^^^^^^^^ undefined. Did you forget to declare type parameter `State` of identifier `Component`?

node_modules/native-base/src/backward/Widgets/CardSwiper.js:84
 84:     const { pan, enter } = this.state;
                      ^^^^^ property `enter`. Property cannot be accessed on possibly undefined value
 84:     const { pan, enter } = this.state;
                                ^^^^^^^^^^ undefined. Did you forget to declare type parameter `State` of identifier `Component`?

node_modules/native-base/src/backward/Widgets/CardSwiper.js:96
 96:       <View ref={c => this._root = c}>
                                ^^^^^ property `_root`. Property not found in
 96:       <View ref={c => this._root = c}>
                           ^^^^ CardSwiper

node_modules/native-base/src/backward/Widgets/Container.js:19
 19:         style : React.PropTypes.object
                     ^^^^^^^^^^^^^^^^^^^^^^ object type. Ineligible value used in/as type annotation (did you forget 'typeof'?)
 19:         style : React.PropTypes.object
                     ^^^^^^^^^^^^^^^^^^^^^^ object

node_modules/native-base/src/backward/Widgets/Container.js:73
 73:       <View ref={c => this._root = c} {...this.prepareRootProps()}>
                                ^^^^^ property `_root`. Property not found in
 73:       <View ref={c => this._root = c} {...this.prepareRootProps()}>
                           ^^^^ Container

node_modules/native-base/src/backward/Widgets/FooterTab.js:87
 87:       <View ref={c => this._root = c} {...this.props} >
                                ^^^^^ property `_root`. Property not found in
 87:       <View ref={c => this._root = c} {...this.props} >
                           ^^^^ FooterTab

node_modules/native-base/src/backward/Widgets/Gravatar.js:52
 52:       <Image ref={c => this._root = c} {...props} source={{ uri }} />
                                 ^^^^^ property `_root`. Property not found in
 52:       <Image ref={c => this._root = c} {...props} source={{ uri }} />
                            ^^^^ Gravatar

node_modules/native-base/src/backward/Widgets/Header.js:16
 16:         searchBar : React.PropTypes.bool,
                                         ^^^^ Unexpected token bool

node_modules/native-base/src/backward/Widgets/InputGroup.js:12
 12:         borderType : React.PropTypes.string,
                                          ^^^^^^ Unexpected token string

node_modules/native-base/src/backward/Widgets/ListItem.js:210
210:         style: this.getInitialStyle().gravatar,
                                           ^^^^^^^^ property `gravatar`. Property not found in
210:         style: this.getInitialStyle().gravatar,
                    ^^^^^^^^^^^^^^^^^^^^^^ object literal

node_modules/native-base/src/backward/Widgets/ListItem.js:439
439:         ref={c => this._root = c}
                            ^^^^^ property `_root`. Property not found in
439:         ref={c => this._root = c}
                       ^^^^ ListItem

node_modules/native-base/src/backward/Widgets/Subtitle.js:12
 12:       <Text ref={c => this._root = c} {...this.props} />
                                ^^^^^ property `_root`. Property not found in
 12:       <Text ref={c => this._root = c} {...this.props} />
                           ^^^^ Subtitle

node_modules/native-base/src/backward/Widgets/Text.js:15
 15:       <TextRN ref={c => this._root = c} {...this.props}>{this.props.children}</TextRN>
                                  ^^^^^ property `_root`. Property not found in
 15:       <TextRN ref={c => this._root = c} {...this.props}>{this.props.children}</TextRN>
                             ^^^^ Text

node_modules/native-base/src/backward/Widgets/View.js:14
 14:        <View ref={c => this._root = c} {...this.props}></View>
                                 ^^^^^ property `_root`. Property not found in
 14:        <View ref={c => this._root = c} {...this.props}></View>
                            ^^^^ ViewNB

node_modules/native-base/src/basic/Actionsheet.js:22
 22:     this.state = {
                      ^ object literal. This type is incompatible with
 19: class ActionSheetContainer extends Component {
                                        ^^^^^^^^^ undefined. Did you forget to declare type parameter `State` of identifier `Component`?

node_modules/native-base/src/basic/Actionsheet.js:46
 46:       this.setState({
           ^ call of method `setState`
 46:       this.setState({
                         ^ property `callback` of object literal. Property cannot be assigned on possibly undefined value
 19: class ActionSheetContainer extends Component {
                                        ^^^^^^^^^ undefined. Did you forget to declare type parameter `State` of identifier `Component`?

node_modules/native-base/src/basic/Actionsheet.js:46
 46:       this.setState({
           ^ call of method `setState`
 46:       this.setState({
                         ^ property `cancelButtonIndex` of object literal. Property cannot be assigned on possibly undefined value
 19: class ActionSheetContainer extends Component {
                                        ^^^^^^^^^ undefined. Did you forget to declare type parameter `State` of identifier `Component`?

node_modules/native-base/src/basic/Actionsheet.js:46
 46:       this.setState({
           ^ call of method `setState`
 46:       this.setState({
                         ^ property `destructiveButtonIndex` of object literal. Property cannot be assigned on possibly undefined value
 19: class ActionSheetContainer extends Component {
                                        ^^^^^^^^^ undefined. Did you forget to declare type parameter `State` of identifier `Component`?

node_modules/native-base/src/basic/Actionsheet.js:46
 46:       this.setState({
           ^ call of method `setState`
 46:       this.setState({
                         ^ property `items` of object literal. Property cannot be assigned on possibly undefined value
 19: class ActionSheetContainer extends Component {
                                        ^^^^^^^^^ undefined. Did you forget to declare type parameter `State` of identifier `Component`?

node_modules/native-base/src/basic/Actionsheet.js:46
 46:       this.setState({
           ^ call of method `setState`
 46:       this.setState({
                         ^ property `message` of object literal. Property cannot be assigned on possibly undefined value
 19: class ActionSheetContainer extends Component {
                                        ^^^^^^^^^ undefined. Did you forget to declare type parameter `State` of identifier `Component`?

node_modules/native-base/src/basic/Actionsheet.js:46
 46:       this.setState({
           ^ call of method `setState`
 46:       this.setState({
                         ^ property `modalVisible` of object literal. Property cannot be assigned on possibly undefined value
 19: class ActionSheetContainer extends Component {
                                        ^^^^^^^^^ undefined. Did you forget to declare type parameter `State` of identifier `Component`?

node_modules/native-base/src/basic/Actionsheet.js:46
 46:       this.setState({
           ^ call of method `setState`
 46:       this.setState({
                         ^ property `title` of object literal. Property cannot be assigned on possibly undefined value
 19: class ActionSheetContainer extends Component {
                                        ^^^^^^^^^ undefined. Did you forget to declare type parameter `State` of identifier `Component`?

node_modules/native-base/src/basic/Actionsheet.js:67
 67:         visible={this.state.modalVisible}
                                 ^^^^^^^^^^^^ property `modalVisible`. Property cannot be accessed on possibly undefined value
 67:         visible={this.state.modalVisible}
                      ^^^^^^^^^^ undefined. Did you forget to declare type parameter `State` of identifier `Component`?

node_modules/native-base/src/basic/Actionsheet.js:68
 68:         onRequestClose={()=> this.setState({modalVisible: false})}
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call of method `setState`
 68:         onRequestClose={()=> this.setState({modalVisible: false})}
                                                ^^^^^^^^^^^^^^^^^^^^^ property `modalVisible` of object literal. Property cannot be assigned on possibly undefined value
 19: class ActionSheetContainer extends Component {
                                        ^^^^^^^^^ undefined. Did you forget to declare type parameter `State` of identifier `Component`?

node_modules/native-base/src/basic/Actionsheet.js:70
 70:        <TouchableOpacity activeOpacity={1} onPress={()=> this.setState({modalVisible: false})} style={{backgroundColor: 'rgba(0,0,0,0.4)', flex: 1, justifyContent: 'flex-end'}}>
                                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call of method `setState`
 70:        <TouchableOpacity activeOpacity={1} onPress={()=> this.setState({modalVisible: false})} style={{backgroundColor: 'rgba(0,0,0,0.4)', flex: 1, justifyContent: 'flex-end'}}>
                                                                            ^^^^^^^^^^^^^^^^^^^^^ property `modalVisible` of object literal. Property cannot be assigned on possibly undefined value
 19: class ActionSheetContainer extends Component {
                                        ^^^^^^^^^ undefined. Did you forget to declare type parameter `State` of identifier `Component`?

node_modules/native-base/src/basic/Actionsheet.js:71
 71:         <TouchableOpacity activeOpacity={1} style={{backgroundColor: '#fff', height: this.state.length*80, padding: 15, elevation: 4}}>
                                                                                                     ^^^^^^ property `length`. Property cannot be accessed on possibly undefined value
 71:         <TouchableOpacity activeOpacity={1} style={{backgroundColor: '#fff', height: this.state.length*80, padding: 15, elevation: 4}}>
                                                                                          ^^^^^^^^^^ undefined. Did you forget to declare type parameter `State` of identifier `Component`?

node_modules/native-base/src/basic/Actionsheet.js:72
 72:           <Text style={{color: '#757575'}}>{this.state.title}</Text>
                                                            ^^^^^ property `title`. Property cannot be accessed on possibly undefined value
 72:           <Text style={{color: '#757575'}}>{this.state.title}</Text>
                                                 ^^^^^^^^^^ undefined. Did you forget to declare type parameter `State` of identifier `Component`?

node_modules/native-base/src/basic/Actionsheet.js:73
 73:           <List style={{marginHorizontal: -15, marginTop: 15}} dataArray={this.state.items} renderRow={(data, i, id) =>
                                                                                          ^^^^^ property `items`. Property cannot be accessed on possibly undefined value
 73:           <List style={{marginHorizontal: -15, marginTop: 15}} dataArray={this.state.items} renderRow={(data, i, id) =>
                                                                               ^^^^^^^^^^ undefined. Did you forget to declare type parameter `State` of identifier `Component`?


... 362 more errors (only 50 out of 412 errors displayed)
To see all errors, re-run Flow with --show-all-errors
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! CGPSApp@0.0.1 flow: `flow`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the CGPSApp@0.0.1 flow script 'flow'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the CGPSApp package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     flow
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs CGPSApp
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls CGPSApp
npm ERR! There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/agerson/.npm/_logs/2017-05-07T19_37_56_371Z-debug.log

然后我查看了該日志文件

cat /Users/agerson/.npm/_logs/2017-05-07T19_34_43_226Z-debug.log
    0 info it worked if it ends with ok
    1 verbose cli [ '/Users/agerson/.nvm/versions/node/v4.8.2/bin/node',
    1 verbose cli   '/Users/agerson/.nvm/versions/node/v4.8.2/bin/npm',
    1 verbose cli   'run',
    1 verbose cli   'flow' ]
    2 info using npm@4.5.0
    3 info using node@v4.8.2
    4 verbose run-script [ 'preflow', 'flow', 'postflow' ]
    5 info lifecycle CGPSApp@0.0.1~preflow: CGPSApp@0.0.1
    6 silly lifecycle CGPSApp@0.0.1~preflow: no script for preflow, continuing
    7 info lifecycle CGPSApp@0.0.1~flow: CGPSApp@0.0.1
    8 verbose lifecycle CGPSApp@0.0.1~flow: unsafe-perm in lifecycle true
    9 verbose lifecycle CGPSApp@0.0.1~flow: PATH: /Users/agerson/.nvm/versions/node/v4.8.2/lib/node_modules/npm/bin/node-gyp-bin:/Users/agerson/Desktop/CGPSApp/node_modules/.bin:/Users/agerson/.nvm/versions/node/v4.8.2/bin:/Library/Frameworks/Python.framework/Versions/3.5/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Frameworks/Python.framework/Versions/3.5/bin:/Users/agerson/Library/Android/sdk/tools:/Users/agerson/Library/Android/sdk/platform-tools:/Users/agerson/Library/Android/sdk/tools:/Users/agerson/Library/Android/sdk/platform-tools
    10 verbose lifecycle CGPSApp@0.0.1~flow: CWD: /Users/agerson/Desktop/CGPSApp
    11 silly lifecycle CGPSApp@0.0.1~flow: Args: [ '-c', 'flow' ]
    12 silly lifecycle CGPSApp@0.0.1~flow: Returned: code: 2  signal: null
    13 info lifecycle CGPSApp@0.0.1~flow: Failed to exec flow script
    14 verbose stack Error: CGPSApp@0.0.1 flow: `flow`
    14 verbose stack Exit status 2
    14 verbose stack     at EventEmitter.<anonymous> (/Users/agerson/.nvm/versions/node/v4.8.2/lib/node_modules/npm/lib/utils/lifecycle.js:279:16)
    14 verbose stack     at emitTwo (events.js:87:13)
    14 verbose stack     at EventEmitter.emit (events.js:172:7)
    14 verbose stack     at ChildProcess.<anonymous> (/Users/agerson/.nvm/versions/node/v4.8.2/lib/node_modules/npm/lib/utils/spawn.js:40:14)
    14 verbose stack     at emitTwo (events.js:87:13)
    14 verbose stack     at ChildProcess.emit (events.js:172:7)
    14 verbose stack     at maybeClose (internal/child_process.js:862:16)
    14 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:222:5)
    15 verbose pkgid CGPSApp@0.0.1
    16 verbose cwd /Users/agerson/Desktop/CGPSApp
    17 verbose Darwin 16.5.0
    18 verbose argv "/Users/agerson/.nvm/versions/node/v4.8.2/bin/node" "/Users/agerson/.nvm/versions/node/v4.8.2/bin/npm" "run" "flow"
    19 verbose node v4.8.2
    20 verbose npm  v4.5.0
    21 error code ELIFECYCLE
    22 error errno 2
    23 error CGPSApp@0.0.1 flow: `flow`
    23 error Exit status 2
    24 error Failed at the CGPSApp@0.0.1 flow script 'flow'.
    24 error Make sure you have the latest version of node.js and npm installed.
    24 error If you do, this is most likely a problem with the CGPSApp package,
    24 error not with npm itself.
    24 error Tell the author that this fails on your system:
    24 error     flow
    24 error You can get information on how to open an issue for this project with:
    24 error     npm bugs CGPSApp
    24 error Or if that isn't available, you can get their info via:
    24 error     npm owner ls CGPSApp
    24 error There is likely additional logging output above.
    25 verbose exit [ 2, true ]

檢查https://github.com/GeekyAnts/NativeBase/issues/342以忽略基於本機的流錯誤。

# Ignore native base
.*/node_modules/native-base/*
.*/node_modules/react-native-easy-grid/*
.*/node_modules/react-native-keyboard-aware-scroll-view/*

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM