haxtheweb / issues

Issue queue for hax, haxcms, elmsln, lrnwebcomponents, wcfactory, websites and more.
Apache License 2.0
11 stars 1 forks source link

Graceful message if git not installed instead of Crashing #2130

Open singpolyma opened 2 weeks ago

singpolyma commented 2 weeks ago

Running docker run --network=host node:20-alpine npx @haxtheweb/haxcms-nodejs I don't get any error or feedback about this on first run or in the UI, but when I create a new project it crashes due to git not being present and the web UI hangs at 100%:

node:events:497
      throw er; // Unhandled 'error' event
      ^

Error: spawn git ENOENT
    at ChildProcess._handle.onexit (node:internal/child_process:286:19)
    at onErrorNT (node:internal/child_process:484:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Emitted 'error' event on ChildProcess instance at:
    at ChildProcess._handle.onexit (node:internal/child_process:292:12)
    at onErrorNT (node:internal/child_process:484:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn git',
  path: 'git',
  spawnargs: [ 'init' ]
}
btopro commented 2 weeks ago

I'm curious as I could see a few solutions here as to what would your expected behavior be:

singpolyma commented 2 weeks ago

I would expect an error message in the UI so the user knows they need to install git

btopro commented 2 weeks ago

That makes sense. I was hoping there was a way to bundle the command up so it would install what it needed but probably more of a telling the person to go install it instead. Perhaps on initial install this test can run and give them the command to do the installation