air icon indicating copy to clipboard operation
air copied to clipboard

Air not running properly on windows 11 64bit

Open minolmal opened this issue 1 year ago • 13 comments

I have tried several suggestions in issues, (both open and closed) still couldn't get Air to properly run the binary. I've run with -d in case it helps. Screenshot 2024-10-10 060728

This is the default config I get from air init. Screenshot 2024-10-10 060748

as you can see here, binary works fine when I run it manually. Screenshot 2024-10-10 062026

I'm not quite sure if it's powershell or Win11, but you can use normal "/" in commands and it works fine. (even in cmd) Screenshot 2024-10-10 062151

(I'm running PowerShell 7.4.5 and Windows 11 Home 22H2 22621.4317)

minolmal avatar Oct 10 '24 00:10 minolmal

Having the same issue.

image

LuanZwang avatar Oct 10 '24 01:10 LuanZwang

I've tested the commands in toml. they work fine as well. Screenshot 2024-10-10 063858

I'm new to Go. but I think issue should be somewhere around final paths parsed to "runner".

minolmal avatar Oct 10 '24 01:10 minolmal

I have the same issue which is has weird path to bin file -> '\"main.exe\"' this looks like a bug, but you can avoid this till there is a fix by specifying an absolute path in the toml file -> [build] -> full_bin =""

omarattia3143 avatar Oct 10 '24 14:10 omarattia3143

I have the same issue which is has weird path to bin file -> '"main.exe"' this looks like a bug, but you can avoid this till there is a fix by specifying an absolute path in the toml file -> [build] -> full_bin =""

I set full_bin = "<absolute_path>\\tmp\\main.exe" and it worked flawlessly.

minolmal avatar Oct 10 '24 17:10 minolmal

I have the same issue which is has weird path to bin file -> '"main.exe"' this looks like a bug, but you can avoid this till there is a fix by specifying an absolute path in the toml file -> [build] -> full_bin =""

Worked perfectly after it. Thank you!

LuanZwang avatar Oct 10 '24 18:10 LuanZwang

I have the same issue which is has weird path to bin file -> '"main.exe"' this looks like a bug, but you can avoid this till there is a fix by specifying an absolute path in the toml file -> [build] -> full_bin =""

I set full_bin = "<absolute_path>\\tmp\\main.exe" and it worked flawlessly.

This resolved my issue as well

f-llewellyn avatar Oct 11 '24 14:10 f-llewellyn

@minolmal, could you close the issue?

LuanZwang avatar Oct 11 '24 14:10 LuanZwang

@minolmal, could you close the issue?

no this was a temp solution, this needs to be fixed

omarattia3143 avatar Oct 11 '24 14:10 omarattia3143

@minolmal, could you close the issue?

no this was a temp solution, this needs to be fixed

yeah, you're right.

LuanZwang avatar Oct 11 '24 16:10 LuanZwang

I found the issue in this line of code in runner/config.go: c.Build.Bin = fmt.Sprintf("%q", c.Build.Bin) https://github.com/air-verse/air/blame/df13da5c21362c64f16d455feb28d189d9c9f8fd/runner/config.go#L333 related to #646 when the line removed it is working as expected

omarattia3143 avatar Oct 11 '24 20:10 omarattia3143

Just a comment here as I'm experiencing this on windows 10 also. Not sure what whitespace has to do with this issue but it's mentioned in a pull request dealing with whitespace. The problem seems to be that the full path to the exe is being encoded and escaped as a json string would be. It seems to be returning the same error that would be returned by a command prompt like this:

C:\Users\jason>c:\hello.exe
'c:\hello.exe' is not recognized as an internal or external command,
operable program or batch file.

But the air command includes surrounding double quotes escaped with backslashes and backslashes escaping the other backslashes exactly like this:

C:\Users\jason>\"c:\\hello.exe\"
'\"c:\\hello.exe\"' is not recognized as an internal or external command,
operable program or batch file.

Ah, I see now. That merged PR is mentioned because it is the one that introduced the bug, probably by these lines:

return fmt.Sprintf("%q", filepath.Join(c.Root, bin))

JasonGoemaat avatar Oct 13 '24 04:10 JasonGoemaat

I found the issue in this line of code in runner/config.go: c.Build.Bin = fmt.Sprintf("%q", c.Build.Bin) https://github.com/air-verse/air/blame/df13da5c21362c64f16d455feb28d189d9c9f8fd/runner/config.go#L333 related to #646 when the line removed it is working as expected

Yeah, that is the source of the issue in my win10 as well

before after

moboqe avatar Oct 15 '24 18:10 moboqe

I'll revert the commit and release a new version. Then fix and fully test the broken pr.

cosmtrek avatar Oct 16 '24 04:10 cosmtrek

Air v1.61.1 with default config seems to be working fine.

@cosmtrek Thank you for the quick response. I think this commit should correct several issues in the issues log. should I close this one?

minolmal avatar Oct 21 '24 19:10 minolmal

i had also faced same problem ,

building... !exclude .git running... '\"C:\\Users\\PC_RC\\OneDrive\\Documents\\project-go\\tmp\\main.exe\"' is not recognized as an internal or external command, operable program or batch file. Process Exit with Code: 1

i have deleted air binary file from C:\Users\PC_RC\go\bin

and then i reinstalled the air package using

go install github.com/air-verse/air@latest

which fixed the issue

PRAMOD-SAMSON avatar Nov 30 '24 06:11 PRAMOD-SAMSON

@PRAMOD-SAMSON , yes, I had also done the same thing. it works!!!

Ankush-Hegde avatar Nov 30 '24 06:11 Ankush-Hegde

seems work. well done bros

xiantang avatar Dec 16 '24 17:12 xiantang

seems work. well done bros

Yoooo brooo!!!🥳🥳🥳🥳

Ankush-Hegde avatar Dec 16 '24 17:12 Ankush-Hegde