air icon indicating copy to clipboard operation
air copied to clipboard

error on Windows

Open quinn opened this issue 7 months ago • 8 comments

Start-Process : A positional parameter cannot be found that accepts argument '.\tmp\main.exe'.
At line:1 char:1
+ start /wait /b .\tmp\main.exe server
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Start-Process], ParameterBindingException
    + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.StartProcessCommand

config:

[build]
cmd = "go build -o ./tmp/main.exe ."
bin = ".\\tmp\\main.exe"
full_bin = ".\\tmp\\main.exe"

quinn avatar Jun 17 '25 03:06 quinn

A similar error occurred on the command line in the PowerShell environment:

air '-build.cmd' 'go build ./cmd/wpg' '-build.bin' 'wpg web -a 22567 -r E:\conero\....'

Error msg:

+ & "........\wpg web -a 22567 - ...
+   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (D:\conero\repos...endoc\uymasdocs:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

In fact, directly executing commands that prompt exceptions is effective. Have to switch to v1.61.7, back.

conero avatar Jun 17 '25 03:06 conero

Hi, does anyone know how to solve this problem? failed to start tmp\main.exe, error: exec: "cmd": executable file not found in %PATH%

Verbunix avatar Jun 25 '25 20:06 Verbunix

can confirm. the Start-Process : A positional parameter cannot be found that accepts argument '.\tmp\main.exe'. issue happens only in the latest 1.62.0 version. Switching to version 1.61.7 fixes the issue

syz51 avatar Jul 03 '25 01:07 syz51

Same, you can work around this somewhat by creating a bat file that runs air. This effectively runs air inside CMD so it works properly. Not ideal but it works.

Set-Location $PSScriptRoot
Start-Process -FilePath "cmd" -ArgumentList "/c", "air" -Wait -NoNewWindow

BumpyClock avatar Jul 18 '25 13:07 BumpyClock

can confirm. the Start-Process : A positional parameter cannot be found that accepts argument '.\tmp\main.exe'. issue happens only in the latest 1.62.0 version. Switching to version 1.61.7 fixes the issue

for someone has this issue please try this one, i fix by this way

Yogabayu avatar Jul 31 '25 12:07 Yogabayu

can confirm. the Start-Process : A positional parameter cannot be found that accepts argument '.\tmp\main.exe'. issue happens only in the latest 1.62.0 version. Switching to version 1.61.7 fixes the issue

This resolved my issue as well. Thank you!

fagbenjaenoch avatar Aug 13 '25 17:08 fagbenjaenoch

Start-Process : A positional parameter cannot be found that accepts argument '.\tmp\main.exe'.
At line:1 char:1
+ start /wait /b .\tmp\main.exe server
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Start-Process], ParameterBindingException
    + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.StartProcessCommand

config:

[build]
cmd = "go build -o ./tmp/main.exe ."
bin = ".\\tmp\\main.exe"
full_bin = ".\\tmp\\main.exe"

@quinn, i already attached new PR, could you test in your environment? https://github.com/air-verse/air/pull/793

thanks.

prolifel avatar Aug 24 '25 14:08 prolifel

can confirm. the Start-Process : A positional parameter cannot be found that accepts argument '.\tmp\main.exe'. issue happens only in the latest 1.62.0 version. Switching to version 1.61.7 fixes the issue

go install github.com/air-verse/[email protected]

ffrz avatar Nov 02 '25 14:11 ffrz