Search code examples
homebrewflow-js

Homebrew install the old version of flow


I cd to my react-native project directory, and run flow, it prompts me Launching Flow server for /Users/... Wrong version of Flow. The config specifies version ^0.32.0 but this is version 0.33.0. How do I install the previous version flow with Homebrew?


Solution

  • If you run brew info flow in the console, you'll see a line similar to the following:

    flow: stable 0.33.0 (bottled), HEAD
    

    This means that the person managing the flow homebrew formula is removing old versions as the version gets updated, so it's impossible for you to access any old versions, barring performing some behind the scenes business I'm unaware of.


    Luckily, there's a solution for you. I assume you're using npm, in which case you can try the following:

    npm install [email protected] -g
    

    This will install a binary wrapper for flow, packaged through npm, in which previous versions are all available. By installing globally, you can use the flow commands in the command line.


    If you don't want to install globally, for fear of conflicting with other projects, etc., you can still install locally and use flow:

     npm install [email protected]
    

    Now, add the following to package.json:

    "scripts": {
        ...
        "flow": "flow ."
    },
    

    And now, you'll be able to run flow on your project with the command:

    npm run flow