Flow: Flow cannot resolve modules when run on the same project on a different computer

Created on 26 May 2018  Â·  7Comments  Â·  Source: facebook/flow

I'm using Flow version 0.72.0 for my project. On my Windows laptop, running flow works fine; however, on my desktop I'm getting a could not resolve module error for every import that I have. Both relative (import _ from './search_screens';) and absolute (import _ from 'react-native';) imports seem to raise this error. Is there anything I could be doing wrong?

Here's what my .flowconfig looks like (basically the same as the default React Native one but w/ a few changes):

[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

; Ignore polyfills
.*/Libraries/polyfills/.*

; Ignore metro
.*/node_modules/metro/.*

[include]

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

[options]
emoji=true

module.system=haste

module.use_strict=true

munge_underscores=true

module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub'
# These should correspond to the aliases for babel-plugin-module-resolver in .babelrc
module.name_mapper='^app/\([-a-zA-Z0-9$_/]+\)$' -> '<PROJECT_ROOT>/src/\1'
module.name_mapper='^core/\([-a-zA-Z0-9$_/]+\)$' -> '<PROJECT_ROOT>/src/core/\1'
module.name_mapper='^tests/\([-a-zA-Z0-9$_/]+\)$' -> '<PROJECT_ROOT>/__tests__/\1'

module.file_ext=.js
module.file_ext=.jsx
module.file_ext=.json
module.file_ext=.native.js

suppress_type=$FlowIssue
suppress_type=$FlowFixMe
suppress_type=$FlowFixMeProps
suppress_type=$FlowFixMeState

suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError

[version]
>=0.72.0

All 7 comments

same here

Could either of you provide a minimal repo where this error can be reproduced? Also, are both computers running the same version of windows?

@mrkev just create a new app with react-native init with version 0.55
then add all libraries needed, then run yarn run flow, will get the issue.

my env is windows 10, node 8

If the error works on one computer but not the other, I'd rather download a repo that I know is problematic rather than try to repro myself. There's 2000+ other issues to dive into, trying to manually repro each one doesn't scale ¯\_(ツ)_/¯

@mrkev you are right, today when I re do the creation and test. the problem gone! no special treatments, it just pass all test. so maybe some libs changed or update make affects.

Hmmm interesting. Yeah, I'll call this issue closed (:

TRY

/path/to/project/node_modules/.bin/flow stop
/path/to/project/yarn run flow (or your flow invoking script)
Was this page helpful?
0 / 5 - 0 ratings