最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Flow erroring "cant resolve module" when importing node modules - Stack Overflow

programmeradmin3浏览0评论

I recently added this to my flow config due to tons of errors related to node modules that flow picks up

[ignore]
.*/node_modules/.*

This solved those errors, but introduced new one. Now every module I import results in an error where flow says it can't resolve it, hence leading me to think this is due to that ignore rule I added.

Is there a way to fix this because here removing this line just introduces different kind of error, keeping it in still makes it error.

I recently added this to my flow config due to tons of errors related to node modules that flow picks up

[ignore]
.*/node_modules/.*

This solved those errors, but introduced new one. Now every module I import results in an error where flow says it can't resolve it, hence leading me to think this is due to that ignore rule I added.

Is there a way to fix this because here removing this line just introduces different kind of error, keeping it in still makes it error.

Share Improve this question edited Nov 14, 2017 at 18:35 Nat Mote 4,08619 silver badges30 bronze badges asked Oct 24, 2017 at 9:00 IljaIlja 46.5k103 gold badges289 silver badges527 bronze badges 2
  • 1 I have the same issue – alaboudi Commented Apr 15, 2018 at 23:05
  • It's not supposed to cause this kind of error, is it possible that those dependencies are not actually in node_modules? – frontsideair Commented Apr 19, 2018 at 19:47
Add a ment  | 

2 Answers 2

Reset to default 9

It's a little late now, but for anyone stumbling along this question in the future: you shouldn't ignore your node_modules folder. Flow is supposed to read from that folder and analyze the files inside it.

Actually this is because of the module has no typed definitions. So we can just use flow-typed to create any definition.

  1. Run yarn global add flow-typed to install flow-typed globally.

  2. Go to project folder: flow-typed install

  3. Close your terminal and try to run npm run flow again. That's it.

Ref: https://github./facebook/flow/issues/5935

发布评论

评论列表(0)

  1. 暂无评论