gpt4 book ai didi

react-native - react native 和流程错误消息

转载 作者:行者123 更新时间:2023-12-02 21:49:50 24 4
gpt4 key购买 nike

嗨,我试图用 React Native 做一些 hello world。我创建了项目“react-native init”,更改了“.flowconfig”中的流程版本。

运行流程,它给了我 153 个错误,这些错误位于 node_modules 文件夹中,例如node_modules/react-native/Libraries

有人遇到同样的问题吗?

最佳答案

我遇到了同样的问题。您需要执行两个步骤:

1。将您的 .flowconfig 与此文件进行比较并添加您缺少的行:

[ignore]
; We fork some components by platform
.*/*[.]android.js

; Ignore "BUCK" generated dirs
<PROJECT_ROOT>/\.buckd/

; Ignore unexpected extra "@providesModule"
.*/node_modules/.*/node_modules/fbjs/.*

; Ignore duplicate module providers
; For RN Apps installed via npm, "Libraries" folder is inside
; "node_modules/react-native" but in the source repo it is in the root
.*/Libraries/react-native/React.js
.*/Libraries/react-native/ReactNative.js

<PROJECT_ROOT>/node_modules/.*
<PROJECT_ROOT>/libdefs.js
.*/__tests__/.*

[include]

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

2。在根文件夹中创建libdefs.js。它应该看起来像这样:

declare module 'react-native' { declare var exports: any; }
declare module 'jest' { declare var exports: any; }

另外,声明所有模块流程都会引发错误(例如'mobx' - 我知道这可能有点令人沮丧,但它必须完成)

关于react-native - react native 和流程错误消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42829090/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com