Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot resolve module when running Flow on Windows #21311

Closed
zenz opened this issue Sep 25, 2018 · 19 comments
Closed

Cannot resolve module when running Flow on Windows #21311

zenz opened this issue Sep 25, 2018 · 19 comments
Labels
Bug Flow Platform: Windows Building on Windows. Resolution: Locked This issue was locked by the bot.

Comments

@zenz
Copy link

zenz commented Sep 25, 2018

Environment

Run react-native info in your terminal and paste its contents here.
react-native info

React Native Environment Info:
System:
OS: Windows 10
CPU: x64 Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz
Memory: 2.09 GB / 7.91 GB
Binaries:
Yarn: 1.9.4 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 6.1.0 - C:\Program Files\nodejs\npm.CMD

Description

using flow not working and got error with "Cannot resolve module XXXXXX". but same action under macOS works well.

Reproducible Demo

react-native init testapp
cd testapp
yarn add flow-bin@0.78.0 --dev
yarn flow

under windows will get errors.

@hramos hramos added the Platform: Windows Building on Windows. label Sep 25, 2018
@hramos hramos changed the title [0.57.x] flow checking not working under Windows Cannot resolve module when running Flow on Windows Oct 5, 2018
@zenz
Copy link
Author

zenz commented Oct 6, 2018

with

"@babel/runtime": "^7.1.2",
 "metro-react-native-babel-preset": "0.48.0",

The issue seems had been fixed. So I close this now.

Sorry, the above didn't solve the issue. the error gone just because I put // @flow after imports.

@zenz zenz closed this as completed Oct 6, 2018
@zenz
Copy link
Author

zenz commented Oct 7, 2018

Sorry, the above didn't solve the issue. the error gone just because I put // @flow after imports.

@zenz zenz reopened this Oct 7, 2018
@zenz
Copy link
Author

zenz commented Oct 22, 2018

No other one using flow under windows or don't have any problem on this?

@jlkalberer
Copy link

I had the issue but I just added more ignores to the flowconfig

@zenz
Copy link
Author

zenz commented Oct 26, 2018

0.57.4 is released now, but this issue is not solved yet.
waiting.....

@gengjiawen
Copy link
Contributor

I have contact with core members, maybe an issue related to metro.

@zenz
Copy link
Author

zenz commented Oct 31, 2018

@gengjiawen Thank you!

@gengjiawen
Copy link
Contributor

@TheSavior Looks like a flow issue, can you find some people work on this ?

$ flow check --flowconfig-name .flowconfig.android
Error --------------------------------------------------------------- IntegrationTests/AccessibilityManagerTest.js:16:39

Cannot resolve module `RCTDeviceEventEmitter`.

   16| const RCTDeviceEventEmitter = require('RCTDeviceEventEmitter');
                                             ^^^^^^^^^^^^^^^^^^^^^^^


Error -------------------------------------------------------------------------- IntegrationTests/AppEventsTest.js:18:28

Cannot resolve module `deepDiffer`.

   18| const deepDiffer = require('deepDiffer');

@gengjiawen
Copy link
Contributor

gengjiawen commented Nov 5, 2018

I have reported to flow team too facebook/flow#7138.

@gengjiawen
Copy link
Contributor

Update: fb look into this, hopefully we can fix this soon.

@jamesisaac
Copy link
Contributor

I believe this should fix it: facebook/flow#7419

@zenz
Copy link
Author

zenz commented Feb 1, 2019

@jamesisaac Thank you for the information. It's not yet apply to release package yet. So I will just wait because I don't want to compile it by myself.

@gengjiawen
Copy link
Contributor

@jamesisaac Looks like still not working, see windows build on this pr: #21401.

@jamesisaac
Copy link
Contributor

@gengjiawen Unrelated error? Or am I looking in the wrong place? Here all I see is:

C:\projects\react-native\node_modules\flow-bin\cli.js:17
  throw new Error('Platform not supported.');
  ^

I.e. Flow is not even starting correctly on AppVeyor. Whereas this issue is about the "Cannot resolve module" error once Flow does run.

Had a quick look at cli.js but I'm not really familiar with the pattern they're trying to use there, so not sure why it's not working on AppVeyor.

@gengjiawen
Copy link
Contributor

gengjiawen commented Feb 19, 2019

Is it because the flow server still has bug on windows ?
The appveyor env

System:
    OS: Windows 8.1
    CPU: (2) ia32 Intel(R) Xeon(R) CPU E5-2697 v3 @ 2.60GHz
    Memory: 2.90 GB / 4.88 GB
  Binaries:
    Node: 10.15.1 - C:\Program Files (x86)\nodejs\node.EXE
    Yarn: 1.9.4 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 6.4.1 - C:\Program Files (x86)\nodejs\npm.CMD
  SDKs:
    Android SDK:
      Android NDK: 17.2.4988734
  Languages:
    Bash: 4.4.19 - C:\Program Files\Git\usr\bin\bash.EXE
    Go: 1.11 - C:\go\bin\go.EXE
    Perl: 5.22.1 - C:\Perl\bin\perl.EXE
    Python: 2.7.15 - /c/Python27/python
    Ruby: 1.9.3 - C:\Ruby193\bin\ruby.EXE
  Browsers:
    Internet Explorer: 11.0.9600.19036

@gengjiawen
Copy link
Contributor

Also on my windows 10 it still failed with

npm ERR! code ELIFECYCLE
npm ERR! errno 110
npm ERR! react-native@1000.0.0 flow-check-android: `flow check --flowconfig-name .flowconfig.android`
npm ERR! Exit status 110
npm ERR! 
npm ERR! Failed at the react-native@1000.0.0 flow-check-android script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Flow seems pretty much unusable in windows.

@jamesisaac
Copy link
Contributor

jamesisaac commented Feb 19, 2019

On my Win10 machine this works fine in Git Bash and PowerShell:

$ git clone https://github.com/facebook/react-native
$ cd react-native
$ yarn install

$ yarn flow
# Flow check finishes, 2 errors about `unclear-type` (`any` usage).
# Prior to fix it would have come back with hundreds of "Cannot resolve module" errors.

$ yarn run flow-check-android
# Again, flow check finishes with 2 `unclear-type` errors.

Try running yarn flow instead of yarn run flow-check-android as it gives more real-time output. But I do think this is an unrelated issue to the one in this topic / my PR.

@zenz
Copy link
Author

zenz commented Feb 28, 2019

with react-native@0.59.0-rc3 and flow-bin@0.93.0(not 0.92.0), this issue gone.

@gengjiawen
Copy link
Contributor

Glad it works. But still need to do work on this repo since there is another issue on windows. I will close this issue for now.

@facebook facebook locked as resolved and limited conversation to collaborators Feb 28, 2020
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Feb 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Flow Platform: Windows Building on Windows. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

6 participants