【发布时间】:2018-10-16 13:59:11
【问题描述】:
我正在尝试使用 React Native 应用程序开始使用 Flow,但我总是收到一个错误,即 node_module 没有正确配置 Flow。
最终在 .flowconfig 中我添加了一行来忽略 node_module 导演下的所有内容,但这给了我一个错误,它无法找到“react native”
> Spawned flow server (pid=70665)
> Logs will go to /private/tmp/flow/zSUserszSaxxxzSWorkspacezSprojectzSAwesomeProject.log
> Monitor logs will go to /private/tmp/flow/zSUserszSaxxxzSWorkspacezSprojectzSAwesomeProject.monitor_log
> Error ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
> App.js:3:40
>
> Cannot resolve module react-native.
>
> 1│ /* @flow */
> 2│ import React from 'react';
> 3│ import { StyleSheet, Text, View } from 'react-native';
> 4│
> 5│ export default class App extends React.Component {
> 6│ render() {
>
> Error
> ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
> App.js:5:34
>
> Cannot use property Component [1] with less than 1 type argument.
>
> App.js
> 2│ import React from 'react';
> 3│ import { StyleSheet, Text, View } from 'react-native';
> 4│
> 5│ export default class App extends React.Component {
> 6│ render() {
在新的 RN 应用中安装 Flow 的正确方法是什么
create-react-native-app AwesomeProject
cd AwesomeProject
npm 开始
【问题讨论】:
标签: javascript react-native flowtype