yandeu / five-server-vscode

⚡ VSCode Extension for Five Server.
https://marketplace.visualstudio.com/items?itemName=yandeu.five-server
Other
120 stars 9 forks source link

doesn't launch browser automatically anymore #40

Open Hifilo opened 1 year ago

Hifilo commented 1 year ago

Seems to be a new issue as it was working fine before. first sign of problem was opening in firefox devmode loaded site in darkmode, even even if set to light . Then browsers stopped loading automatically later in the day. Loads fine if I manually input the link in any browser.

2023-05-02 12:31:49.601 [error] spawn chrome ENOENT: Error: spawn chrome ENOENT
    at Process.ChildProcess._handle.onexit (node:internal/child_process:283:19)
    at onErrorNT (node:internal/child_process:478:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)

similar error for firefox.

I noticed the other live server extensions are having similar technical issues as well.

Cheers.

Version: 1.77.3 (user setup)
Commit: 704ed70d4fd1c6bd6342c436f1ede30d1cff4710
Date: 2023-04-12T09:16:02.548Z
Electron: 19.1.11
Chromium: 102.0.5005.196
Node.js: 16.14.2
V8: 10.2.154.26-electron.0
OS: Windows_NT x64 10.0.19045 (WSL)
Sandboxed: No
yandeu commented 1 year ago

Is Firefox your default browser? What's your "browser" settings in the extension or its config file?

yandeu commented 1 year ago

Does the command npx five-server@latest . --browser="asdf,firefox" work? First it should try the browser "asdf" which does not exist, then it should open firefox.

Hifilo commented 1 year ago

Does the command npx five-server@latest . --browser="asdf,firefox" work? First it should try the browser "asdf" which does not exist, then it should open firefox.

Thanks @yandeu , firefox is set as the default browser in settings.json. I also changed it to chrome to see if it makes any difference. The server launches, but the browser doesn't. If I open the link in the browser it functions as expected.

Running npx five-server@latest . --browser="asdf,firefox" first told me to install five server which I did. After reload, running command gives:

  Five Server running at:

  > Local:    http://localhost:5500
  > Network:  http://172.19.51.25:5500

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

Error: spawn asdf ENOENT
    at ChildProcess._handle.onexit (node:internal/child_process:283:19)
    at onErrorNT (node:internal/child_process:476: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:289:12)
    at onErrorNT (node:internal/child_process:476:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn asdf',
  path: 'asdf',
  spawnargs: [ 'http://127.0.0.1:5500' ]
}

Node.js v18.16.0

if its of any help, I can't automatically open browser with live server, or live preview.

Hifilo commented 1 year ago

Hi just to give an update.

The issue seems to only affect my WSL/Linux Distro It works fine when launched from index.html within windows OS. Perhaps you may know off hand solution, or where I might find cause?

yandeu commented 1 year ago

For me it works on WSL as well.

Maybe try to re-install your WSL instance:

# list all your wsl installs
wsl --list
# delete a wsl distribution
wsl --unregister NAME
# install new distribution
wsl --install
# set a new default distribution
wsl --set-default NEW_NAME
yandeu commented 1 year ago

Actually, I just tested it on a fresh install WSL + Ubuntu 22.04 + Node.js v20.1.0. It only works when I try to open the default browser, but not, as you wrote above, when I try to open firefox.

Hifilo commented 1 year ago

Actually, I just tested it on a fresh install WSL + Ubuntu 22.04 + Node.js v20.1.0. It only works when I try to open the default browser, but not, as you wrote above, when I try to open firefox.

Can confirm the same thing happening for me on a fresh install w/ Ubuntu.

yandeu commented 1 year ago

Can you test the latest dev version please? npx five-server@dev . --browser="asdf,firefox"

Hifilo commented 1 year ago

running gives result:

  Five Server running at:

  > Local:    http://localhost:5500
  > Network:  http://172.22.93.9:5500

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

Error: spawn asdf ENOENT
    at ChildProcess._handle.onexit (node:internal/child_process:283:19)
    at onErrorNT (node:internal/child_process:476: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:289:12)
    at onErrorNT (node:internal/child_process:476:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn asdf',
  path: 'asdf',
  spawnargs: [ 'http://127.0.0.1:5500' ]
}

if I just write: npx five-server@dev . --browser="firefox"

  Five Server running at:

  > Local:    http://localhost:5500
  > Network:  http://172.22.93.9:5500

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

Error: spawn firefox ENOENT
    at ChildProcess._handle.onexit (node:internal/child_process:283:19)
    at onErrorNT (node:internal/child_process:476: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:289:12)
    at onErrorNT (node:internal/child_process:476:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn firefox',
  path: 'firefox',
  spawnargs: [ 'http://127.0.0.1:5500' ]
}

No browser opens