user16971617
user16971617

Reputation: 535

Connection to flow server got closed. See the output for more information

I got this error message when using React Native on vscode. Is there a way to fix it?

[Error - 2:57:25 PM - MyRealmApp\.flowconfig] Error loading flow using option 'useNPMPackagedFlow'
Pkg flow-bin not found in c:\Users\ReactNativeProjects\MyRealmApp
[Error - 2:57:25 PM - MyRealmApp\.flowconfig] Error loading flow using option 'pathToFlow'
'flow' not found
[Info  - 2:57:25 PM - MyRealmApp\.flowconfig] Falling back to bundled flow.
[Info  - 2:57:27 PM - MyRealmApp\.flowconfig] Using flow 'c:\Users\.vscode\extensions\flowtype.flow-for-vscode-1.9.2\node_modules\flow-bin\flow-win64-v0.107.0\flow.exe' (v0.107.0)
.flowconfig:28 Unsupported option specified! (format.bracket_spacing)
[Error - 2:57:28 PM] Connection to server got closed. Server will not be restarted.

Upvotes: 2

Views: 3567

Answers (1)

Alok
Alok

Reputation: 9008

Basically this issue was caused by not having installed the same version of flow-bin as declared in the .flowconfig of the projects.

Now what you have to do to fix that, is to maintain coherence in the current .flowconfig of the project in your VS Code.

How to do that?

  1. You can just do the below thing and it will fix your issue. If you don't have a yarn, then use npm in place of yarn.
yarn global add flow-bin@version
npm run ios or npm run android
  1. The above will help you fix the issue, but you will always have to check whether they are getting pointed to the same version. In order to fix it stably, you can do the following:
  • In your VS Code settings you need to point flow.pathToFlow to your workspace node_module:
// settings.json
{
  "flow.pathToFlow": "${workspaceFolder}/node_modules/.bin/flow",
}
  • ${workspaceFolder} is a special variable provided by VS Code and it always points to the current project folder. You can find it in the variables reference page of the official docs.

  • You can prefer to use the local Flow module because this way you can ensure that the installed version and the configured one in .flowconfig always match even when you switch projects.

  1. There is an extra setting for that: flow.useNPMPackagedFlow, just set it to true and you are done (no need to change flow.pathToFlow)

Upvotes: 6

Related Questions