gpt4 book ai didi

react-router - 流 : react-router. 未找到所需模块

转载 作者:行者123 更新时间:2023-12-04 05:15:15 25 4
gpt4 key购买 nike

为什么 flow 会抛出这个错误?我的应用程序工作正常,即 react-router npm 模块正在工作。

$ flow
Launching Flow server for /Users/carlf/Documents/dev/reactjs/FlyTweet
Spawned flow server (child pid=21264)
Logs will go to /private/tmp/flow/zSUserszScarlfzSDocumentszSdevzSreactjszSFlyTweet.log
app.js:6
6: import { Router, Route, Link, hashHistory, IndexRoute } from 'react-router';
^^^^^^^^^^^^^^ react-router. Required module not found

最佳答案

大多数 npm 模块没有正确的流定义,因此您需要通过流接口(interface)添加一个。

例如,您可以执行以下操作:

$ npm install iflow-react-router --save-dev

然后在你的flowconfig中

[libs]
./node_modules/iflow-react-router/index.js.flow

然后它的流将能够使用来自 react-router 的流定义。


您可以在这里找到 iflow-react-router https://github.com/marudor/flowInterfaces/tree/master/packages

仅供引用,另一个项目正在出现,您可以在其中找到流接口(interface) https://github.com/flowtype/flow-typed

关于react-router - 流 : react-router. 未找到所需模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37513785/

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