Flow: Flow throws error; module not found but module exists

Created on 27 Jul 2018  ยท  4Comments  ยท  Source: facebook/flow

Even tho module is installed and it exists, Flow cannot resolve it and throws error.
See below:
1) Inside bash I ran flow and it throws error that module is not found

    user@pc:~/code/project$ flow
    Error โ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆ src/functionalities/Growth/index.js:3:25

    Cannot resolve module react-redux.

         1โ”‚ // @flow
         2โ”‚ import React from "react"
         3โ”‚ import { connect } from "react-redux"
         4โ”‚
         5โ”‚ type Props = {
         6โ”‚   children: Function



    Found 1 error

2) Below command checks whether directory exists and it does

    user@pc:~/code/project$ ls node_modules | grep react-redux
    react-redux

I tried to remove and reinstall both node_modules directory and yarn.lock file.

Versions should be matching:

    flow version
    Flow, a static type checker for JavaScript, version 0.77.0

.flowconfig:

    [version]
    0.77.0

enter image description here

Most helpful comment

check your .flowconfig in root path, try to remove <PROJECT_ROOT>/node_modules/.* under the field of [ignore]

All 4 comments

Thanks, I am actually author of that question as well. I think its good enough to have reference to the given answer, let's close this issue in the meanwhile. In addition, its good to note that I didn't have to do these steps in order to make it work. However, I can't really remember how I resolved it. If someone resolved it differently, please answer on SO, and if solution is more ellegant, I will accept it as best answer.

check your .flowconfig in root path, try to remove <PROJECT_ROOT>/node_modules/.* under the field of [ignore]

check your .flowconfig in root path, try to remove /node_modules/.* under the field of [ignore]

How to ignore errors in dependencies without getting "module not found" error?

Was this page helpful?
0 / 5 - 0 ratings