Solve Flow error in Visual Studio Code on a Mac OS
Did you ever get the error: "Wrong version of Flow. The config specifies version ^0.182.0 but this is version 0.158.0" in Visual Studio Code. I got it when building React-Native apps. This error causes the Visual Studio Code Flow plugin to crash. I was banging my head to find a solution. I am not really a Linux guy, that is why.
In my situation, the
.flowconfig of my project defines version "^0.182.0" where the installed version seems version "0.158.0". It crashes because React Native wants to use a later version than I have installed. Changing the version in the config back to 0.158.0 results in a crash too. Because the configuration uses functionality from a new version of Flow than version 0.158.0.
In Visual Studio Code the Flow Language Support plugin is installed but it does not have anything to do with the version of Flow that is used.
Where is Flow?
Normally Flow will be installed in the path
/usr/bin/flow. You can easily find it by calling
Now you know where Flow resides you can remove it. And re-install it. You do it in the following way:
1sudo rm -rf /usr/local/bin/flow # The dir you found with the whereis command 2yarn global add flow-bin@latest
In my case it results in:
1yarn global v1.22.19 2[1/4] 🔍 Resolving packages... 3[2/4] 🚚 Fetching packages... 4[3/4] 🔗 Linking dependencies... 5[4/4] 🔨 Building fresh packages... 6success Installed "firstname.lastname@example.org" with binaries: 7 - flow
Problem solved! Visual Studio Code is running fine, no problems anymore. I hope this helps you out too!