When I open VSCode the flow server doesn't start. 袗 few days ago everything worked. How to fix this problem?
Settings:
{
"javascript.validate.enable": false,
"flow.enabled": true,
"flow.useNPMPackagedFlow": true
}
VSCode: v1.21.1
flow-bin: v0.68.0
Same here. It has started yesterday and I have no idea why (there wasn't any update, right?).
Ok, now I've realized that the whole extension is not running at all (you can check it by Ctrl + Shift + P > Show Running Extensions) even it is enabled. Do you have any ideas what's wrong?
Update: In my case it was a global problem of VS Code, some extensions simply didn't run. Sorry for the confusion on this issue.
BTW: I've solved it by complete reinstallation of VS Code (sudo apt-get purge code, rm -rf ~/.config/Code, rm -rf ~/.vscode, then install VS Code and extensions again).
Same problem but simply uninstalling and reinstalling the extension in vscode worked for me. Issue was simply not seeming to work at all. Opening the console in developer tools had a lot of errors related to the flow extensions.
I've tried reinstalling the extension, but the flow extension still isn't starting. I really don't want to nuke all of vscode if I don't have to...
UPDATE
I was out of commission for a day, but today I tried uninstalling and reinstalling and it's working again. Perhaps my install yesterday was bad and was cached? It seemed to install far too quickly last time. This time installation had a reasonable pause for download and write to disk.
It seems that the extension is looking in the wrong place for the "local" flow-bin package. It is looking in the node_modules of the extension instead of the node_modules of the project.
[2018-05-30T21:10:03.414Z] [INFO] flow - [unknown]: Flow server in c:\Users\Mark\sandbox\demo-mobile-app
[2018-05-30T21:10:03.590Z] [INFO] flow - Path to Flow: C:\Users\Mark\.vscode\extensions\flowtype.flow-for-vscode-0.8.1\node_modules\.bin\flow.cmd
[2018-05-30T21:10:03.818Z] [INFO] flow - Path to Flow: C:\Users\Mark\.vscode\extensions\flowtype.flow-for-vscode-0.8.1\node_modules\.bin\flow.cmd
[2018-05-30T21:10:03.853Z] [INFO] flow - [not installed]: Flow server in c:\Users\Mark\sandbox\demo-mobile-app
[2018-05-30T21:10:03.890Z] [WARN] flow -
same here!!!
I had this issue on a couple of occasions and it was always caused by not having installed the same version of flow-bin as declared in the .flowconfig of the projects.
@matt-block yarn global add flow-bin@version fixed it for me too! Is there a way to get it to point to a local installation instead of the global one? That way I don't have to manually keep track of this everywhere.
@ntomallen Yes, in your VS Code settings you need to point flow.pathToFlow to your workspace node_module:
// settings.json
{
"flow.pathToFlow": "${workspaceRoot}/node_modules/.bin/flow",
}
${workspaceRoot} 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.
I personally prefer to use the local Flow module because this way I can ensure that the installed version and the configured one in .flowconfig always match even when I switch projects.
@matt-block @ntomallen: There is an extra setting for that: flow.useNPMPackagedFlow, just set it to true and you are done (no need to change flow.pathToFlow).
@JakubRimal Thanks! Do you also know what is the behaviour if I have both set up?
flow.pathToFlow? @matt-block Not sure, the documentation doesn't say anything about it. But I would guess that useNPMPackagedFlow overrides pathToFlow.
@JakubRimal Thanks, I asked because I didn't found anything in the docs as well.
Its in the configuration section: https://github.com/flowtype/flow-for-vscode#configuration
Happy to take PRs improving docs 馃憤
If someone is experiencing same problem workspaceRoot has been deprecated in favor of workspaceFolder. So correct path in your settings.json should be:
"flow.pathToFlow": "${workspaceFolder}/node_modules/.bin/flow"
https://code.visualstudio.com/docs/editor/variables-reference#_why-isnt-workspaceroot-documented
@patrikniebur The variables link which you shared only works in vscode debugging and task configuration file not in vscode plugins.
In plugin version 1.1.0 we added support for vscode multi-root workspaces so we also replaces workspaceRoot with workspaceFolder. Check out the updated configuration docs https://github.com/flowtype/flow-for-vscode#configuration for info.
Ah sorry for confusion, it's just a reference to deprecation of workspaceRoot by vscode
@Mayank1791989 I think it's safe to close this, right? :wink:
You just need to correct the [version] in .flowconfig as flow-bin in package.json so you can restart the server
no work
version
react-native-cli: 2.0.1
react-native: 0.62.2
flow 0.125.1
Most helpful comment
I had this issue on a couple of occasions and it was always caused by not having installed the same version of
flow-binas declared in the.flowconfigof the projects.