vscode-flow-ide icon indicating copy to clipboard operation
vscode-flow-ide copied to clipboard

"Cannot find flow in path" despite being in path

Open Venryx opened this issue 7 years ago • 17 comments

I have the flow exe installed at "C:\Program Files\nodejs\node_modules\flow-bin\flow-win64-v0.37.3\flow.exe", and the folder "C:\Program Files\nodejs\node_modules\flow-bin\flow-win64-v0.37.3" is added to the system PATH environment variable, and yet I still get the error above.

It seems to be spawning flow exe's when vs-code launches (and it has the same cpu-usage patterns as the main facebook flow extension), and yet it doesn't actually result in any syntax highlighting or the like.

Venryx avatar Dec 20 '16 19:12 Venryx

You need to set "flowide.pathToFlow" to "flow". It's weird, but works.

Additionally, this plugin spawns mutiple flow processes, and some of them end up eating a lot of cpu resources, but don't actually seem to do anything. Probably they are stuck parsing the code over and over again, or lost among node_modules... I don't know, but it doesn't seem like the plugin works very well, or it gives linting errors after about 5-30 seconds after typing. or all of this might be flow's problem on Windows.

kumarharsh avatar Jan 25 '17 12:01 kumarharsh

I have the same problem

  • I've installed flow locally using npm
  • i set the flowide.pathToFlow to the flow exe in "c:/...node_modules/flow-bin/flow-win64-v0.37.3/flow.exe"
  • but it still shows this error message

slender9168 avatar Mar 05 '17 14:03 slender9168

@slender- set it to 'flow' not '...../flow.exe'.

kumarharsh avatar Mar 06 '17 06:03 kumarharsh

Is this still an issue? Just a note, the flow processes reported are started by Flow itself.

gcazaciuc avatar May 02 '17 16:05 gcazaciuc

Setting it to flow didn't work for me, instead, I have set the flow.useNPMPackagedFlow": true setting so I can use different versions of flow depending on the project, although I don't know if it's the correct way of doing it

alfondotnet avatar May 17 '17 15:05 alfondotnet

I have a mac and I have this issue too... And "flow.enabled": true, already 😞

sidferreira avatar Jun 02 '17 07:06 sidferreira

If I start vscode trough command line it finds global flow, but if I try to open it via GUI it does not.

WhoAteDaCake avatar Jun 02 '17 12:06 WhoAteDaCake

Still doesn't work on Windows. It's available on PATH (from every other application I can run flow.exe from it's environment). I've also tried setting the flowide.pathToFlow to both absolute path to exe, and absolute path to directory. Reloaded window, reinstalled the application. Nothing worked, always shows message [Flow] Cannot find flow in PATH....

martincohen avatar Jun 18 '17 12:06 martincohen

@martincohen : Please upgrade to latest version (1.2.0) , I've made a bunch of fixes regarding on how the paths are picked up. If it still doesn't work please run '"Flow-IDE: Show path to Flow' command ( Open command pallete and type the command) to see what's the path to Flow that vscode-flow-ide picks up and ensure that is correct.

gcazaciuc avatar Jun 20 '17 08:06 gcazaciuc

Anyone still having Windows issues on latest ? If not I'll close it.

gcazaciuc avatar Jun 22 '17 11:06 gcazaciuc

Got recent version (just a few seconds ago). It seems to work correctly on my Mac, but on Windows I get this when I try "Show path fo Flow" (it "worked" before I restarted vscode): image

When it "worked" it has shown something in the lines of path:flow and not the path I've set in the settings. Also on Windows it stopped showing "Cannot find flow in path" error.

What I've tried is also setting the path to "flowide.pathToFlow": "${workspaceRoot}\\node-modules\\flow-bin" on Windows in Workspace settings. It started to work. But I don't really know what path it is using really, it might be it just works thanks to globally installed flow-bin. Please ping me if you manage to fix the "Show path to Flow", or if I did something wrong (is setting to Workspace settings even having an effect?).

martincohen avatar Jul 05 '17 08:07 martincohen

Regarding the error 'command flow.path not found' I believe it's something VSCode related. Let me know what VSCode version and Win version you are using ( I just cannot imagine why it wouldn't work after restart on Win). I'll try to reproduce also on a Win Machine afterwards.

Regarding the setup you need to make sure there are 2 things set(and restart the IDE any time you modify them):

  1. "flowide.enabled" : true
  2. Leave "flowide.pathToFlow" empty

The extensions looks for Flow in the following locations and in this order :

  1. In the path specified by "flowide.pathToFlow". If empty, then check step 2)
  2. In node_modules in current workspace root. On Win the path checked is '{workspaceRoot}\node_modules\.bin\flow.cmd' . Make sure that this path exists and that flow.cmd is in there. If not, it checks step 3
  3. Tries to use flow that is installed globally

For reference, I've pasted below the code snippets that do these checks, as localized in src/utils.ts.

export function nodeModuleFlowLocation(rootPath: string): string {
	if (process.platform === 'win32') {
		return `${rootPath}\\node_modules\\.bin\\flow.cmd`
	} else {
		return `${rootPath}/node_modules/.bin/flow`
	}
}
export function getPathToFlowFromConfig(): string {
	const config = workspace.getConfiguration('flowide');
    if (config) {
        return config.get('pathToFlow').toString();
    }
    return '';
}
export function determineFlowPath() {
    let pathToFlow = '';
    const localInstall = getPathToFlowFromConfig() || nodeModuleFlowLocation(workspace.rootPath);
	if( fs.existsSync(localInstall) ) {
		pathToFlow = localInstall;
	} else {
		pathToFlow = 'flow';
	}
    return pathToFlow;
}

gcazaciuc avatar Jul 05 '17 09:07 gcazaciuc

I've encountered this issue too, what I did is install flow-bin globally but do not install it via yarn, it will still not work install it globally via npm restart vscode and for me it seemed to work now so far

Jplus2 avatar Jan 05 '18 10:01 Jplus2

For me this seems to be broken. Running windows 10. If I do set pathToFlow it says that flow is not in path (even though it is). When I leave it out I see that flow processes get started but I do not get any error highlighting in my editor.

This was all working perfectly fine for me yesterday btw. It literally broke overnight without updating anything

eskydar avatar Feb 01 '18 17:02 eskydar

I had the same issue when I had installed flow with yarn. I followed the recommendation from @Jplus2, installed flow-bin globally with npm like this npm i -g flow-bin and restarted vscode. Now it works.

hnrchrdl avatar Jun 05 '18 08:06 hnrchrdl

I resolved this issue by adding an absolute path in workspace settings for "flowide.pathToFlow".

divyanshu013 avatar Nov 27 '18 06:11 divyanshu013

Same solution as @Jplu2. This really needs to be fixed; for now, fortunately, this is the only project I'm using Yarn for, otherwise, I would need to drop the global install for project-specific installations of flow (that actually work).

Otherwise, good VS Code extension compared to the very broken alternative, "Flow Language Support".

ArcaneEngineer avatar Jan 05 '20 11:01 ArcaneEngineer