air-verse / air

☁️ Live reload for Go apps
GNU General Public License v3.0
16.38k stars 772 forks source link

Air not starting on windows 11 #511

Open Script20 opened 6 months ago

Script20 commented 6 months ago

I have go and htmx project and when I try and start air it doesn't crashes as shown in image below. I have seen in a issue if you put "start" in "full_bin" it will work but that doesn't work for me.

image

My air toml: image

rhianvanesch commented 5 months ago

I just had this issue while doing the same course. It's not related to Air - instead, the .air.toml file needs adjustment for Windows.

I modified lines 7 and 8 of the air.toml to look like the following:

  bin = ".\tmp\main.exe"
  cmd = "go build -o '.\tmp\main.exe' 'cmd\main.go'"

What I changed:

If you're still running into issues, first check that you can run the contents of cmd separately in your terminal, i.e. run

go build -o '.\tmp\main.exe' 'cmd\main.go'

If you get errors here, there are likely errors in your main.go file. (Also, make sure it's actually in the cmd folder and not in a subfolder.)

sajidsalman75 commented 3 months ago

This worked for me on Windows 11

bin = "./tmp/main.exe"
cmd = "go build -o ./tmp/main.exe cmd/main.go"