Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] fvm not working on windows #343

Open
1 task done
Azkarell opened this issue Mar 28, 2024 · 9 comments · May be fixed by #386
Open
1 task done

[BUG] fvm not working on windows #343

Azkarell opened this issue Mar 28, 2024 · 9 comments · May be fixed by #386

Comments

@Azkarell
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Running :FlutterRun with fvm enabled throws ENOENT: no such file or directory in windows
grafik
although path is detected correctly

Expected Behavior

Running :FlutterRun in windows should run flutter

Steps To Reproduce

my conifg with lazy:
{
'akinsho/flutter-tools.nvim',
lazy = false,
dependencies = { 'nvim-lua/plenary.nvim' },
config = function()
require('flutter-tools').setup {
fvm = true,
-- debugger = {
-- enabled = true,
-- run_via_dap = true,
-- register_configurations = function(paths)
-- local file = io.open('.vscode/launch.json', 'r')
-- if file ~= nil then
-- io.close(file)
-- require('dap.ext.vscode').load_launchjs()
-- end
-- end,
-- },
}
require('telescope').load_extension 'flutter'
end,
},

Environment

- OS: Windows 11 Pro
- Flutter version: fvm mit flutter 3.13.9
- Is flutter in $PATH: yes
- neovim version: 0.9.5

Anything else?

I tried to find out what is happening and it might not even be the fault of this tool but i am quite new to neovim and just evaluating if i want to continue using it. what i found that just the line
:lua =vim.uv.spawn("C:\\\fvm\versions\3.13.9\bin\flutter", { { "run" }}) already fails

just running "C:\\\fvm\versions\3.13.9\bin\flutter" in pwsh or cmd or even with Start-Process is working.

@sidlatau
Copy link
Collaborator

Does it work if you run fvm outside neovim: fvm flutter run?

@Azkarell
Copy link
Author

yes everything works as expected outside of neovim. only this plugin/neovim can't start it.

@sidlatau
Copy link
Collaborator

Please check the latest plugin version,d8f2eac commit may help. If there is still a problem, please reopen the issue.

@AyushUlric
Copy link

AyushUlric commented Aug 30, 2024

Facing this issue on windows with latest commits. This happens when I set fvm = true. However I've noticed that if i set fvm = false and add flutterpath = 'C:\Users\daban\fvm\versions\3.19.5\bin\flutter.bat' everthing works fine. Maybe change fvm path from ..\flutter to ..\flutter.bat. Any thoughts?
image

@sidlatau
Copy link
Collaborator

Yea, it looks like missing .bat suffix is a problem. I will reopen this case to fix it.

@sidlatau sidlatau reopened this Aug 30, 2024
@sidlatau sidlatau linked a pull request Aug 30, 2024 that will close this issue
@sidlatau
Copy link
Collaborator

I do not have Windows, so I am not sure if the path is the same as in macOS. @AyushUlric, if you have time please check if this works for you #386? The setup would be:

return {
  "akinsho/flutter-tools.nvim",
  branch = "fvm-on-windows",
...
}

@AyushUlric
Copy link

@sidlatau, didn't work, same error. I hope I didn't mess up the setup as I am fairly new to nvim so attaching my setup code below.

image

image

I then updated all my plugins from the Lazy menu and restarted nvim.

I think on windows flutter and flutter.bat will always be in the same directory and the current path correctly points to the flutter file, hope that helps.

@sidlatau
Copy link
Collaborator

sidlatau commented Sep 5, 2024

@AyushUlric thanks for testing. I see you are using a global path to fvm flutter. But there should be a local one in your project, in .fvm directory:
image
Plugin constructs path .fvm/flutter_sdk/bin/flutter.bat. Does this file exist in your project? Did you run fvm use <flutter version> in your project directory?

@AyushUlric
Copy link

AyushUlric commented Sep 5, 2024

@sidlatau Yes I did run the fvm use command and I have the .fvm directory in my project root. But I noticed that flutter_sdk directory is actually a shotcut which points to the global fvm path. I checked all my fvm projects and it seems to be common in all of them.

image
image

Maybe that's how it is on Windows?

BTW I added the global path because thats what showed up in error logs with path not found.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants