« first day (4115 days earlier)      last day (39 days later) » 

Gao
9:54 AM
Great, I have a script that works in all 3 consoles (cmd, powershell and pwsh) and in the VS Code terminals, but not when run from Windows Terminal or the task scheduler
spent all day debugging this and is about to give up
 
is it just not starting? or does it appear to hang?
 
Gao
it errors out
says npx.cmd command not found, but i printed the PATH and it's fine
 
how are you calling it in the script?
 
Gao
it's a simple gradle task that apparently calls npx.cmd
i suspect it might be coding error in the gradle plugin or some java magic
 
so you're not specifying a path for it
 
Gao
9:58 AM
nope, outside my control, but i did put my npx.cmd in the PATH
 
i was about to ask that
are you sure the PATH varible used in Windows Terminal or the task scheduler the same?
 
Gao
environment appears the same though, so i don't know how it detected a difference
yes, i changed the script to print out PATH and a load of other powershell environment variables and they're all the same
running gradle with stacktrace and debug also didn't help
 
Have you restarted the machine after editing the PATH?
 
Gao
yes
 
is npx installed globally?
 
Gao
10:01 AM
i have a workaround atm, it just doubles the running time, i told the plugin to download node (it won't download twice) and all is fine
@Memor-X installed by default with node.js
yea this problem is bizarre, if it's just windows terminal bugging out, i'd suspect it's an old bug reappearing, but task scheduler...
 
If you (as a test) just run npx.cmd using the absolute path do you get the same error?
 
Gao
@Peilonrayz well i don't know what npx.cmd it runs, but & "C:\Program Files\nodejs\npx.cmd" works fine
it was running fine a few months ago
or weeks, not sure
 
@Gao if possible i'd see if you can install it globally
it sorta sounds like from your work around it's just not installed in whatever environment Windows Terminal or task scheduler is putting it in
 
Gao
@Memor-X npm install -g npx?
 
i belive so
looking on SO i see npm i -g npx
but i assume install is shortened down to i
 
10:08 AM
yeah
 
Gao
ok same then
maybe my windows terminal is broken. yesterday tried to upgrade gradle wrapper and it printed SSPATH* not found blah blah at the end
 
if it works without your work around then you need to package your script with npx somehow so that it's always included when it runs
@Gao but wouldn't explain task scheduler unless it uses the terminal aswell
 
Gao
still doesn't work
```
2024-03-19T18:13:23.221+0800 [INFO] [org.gradle.process.internal.DefaultExecHandle] Starting process 'command 'npx.cmd''. Working directory: D:\workspace\antora Command: npx.cmd --yes antora --fetch --stacktrace antora-playbook.yml
2024-03-19T18:13:23.221+0800 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Changing state to: STARTING
2024-03-19T18:13:23.221+0800 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Waiting until process started: command 'npx.cmd'.
2024-03-19T18:13:23.227+0800 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Changing state to: STARTED
i run the command npx.cmd --yes antora --fetch --stacktrace antora-playbook.yml in windows terminal and it works
 
@Gao it almost looks like what i get when i try to run Windows Commands in Powershell if i try to run them in powershell or pwsh so i just run the script in command prompt using a batch file
 
Gao
10:25 AM
i suspect: 1. blame the antora gradle plugin. 2. blame some windows update messed it up. 3. my windows is messed up somehow (maybe because i messed with the locale a bit to play some touhou game and somehow didn't completely revert it back)
 
@Gao Have you tried running "C:\Program Files\nodejs\npx.cmd" within Gradle?
 
Gao
@Peilonrayz the task finished with no error
 
Can you verify the PATH is correct within Gradle?
 
also, is the path in the System PATH variable or the User PATH variable
because if the latter, then it might be missing if the Terminal and Task Scheduler are using a different user for some reason
 
Gao
nodejs installation directory in the system path i think, and the node global prefix is at the end of the path
 
10:34 AM
if it's in the system one then i'm stumped
 
Gao
lol
i passed the PATH into environment under the antora block and it worked
but still too strange, i didn't update the plugin, so what changed
ok thanks guys, it's somehow fixed with sm like a hack
i've pulled my hairs numerous times working with the asciidoctor tooling and syntax, i'm just keeping it to showcase and would not consider using it seriously
 
i'd see if you can just pass the npx path instead of the PATH Variable. wouldn't be too hacky that way i'd think
 
Gao
@Memor-X nah, i'm not spending any more time on this shit, it used to work without passing anything. the docs aren't that great either
though i'd agree it's a better way to specify the npx path
 

« first day (4115 days earlier)      last day (39 days later) »