1

How do I run a .html file in VS Code on Chrome OS? It sais I need to add the absolute path to browser in a Json file.

Trying to open a .html file in VS Code on Chrome OS

  • What OS are you on? –  Jun 11 '22 at 15:48
  • Chrome OS, I was able to run it through Firefox and Chromium installed as Linux Apps on Linux Beta. But not in the default Chrome Browser on Chrome OS. – James Livingstone Jun 12 '22 at 07:40
  • Would extensions like [Live Server](https://marketplace.visualstudio.com/items?itemName=ritwickdey.LiveServer) help? Try it out. –  Jun 12 '22 at 16:10

1 Answers1

1

U need to install a separate version of Chrome on VS Code then it will work. I just had the same problem and found the solution somewhere hidden on Reddit, but it worked :-)

sudo apt install chromium

Then you can add this to your .vscode/launch.json

  "configurations": [
    {
      "type": "chrome",
      "request": "launch",
      "name": "Launch Chrome against localhost",
      "runtimeExecutable": "/usr/bin/chromium",
      "url": "http://localhost:3000",
      "webRoot": "${workspaceFolder}",
      "smartStep": true
    }
  ]
  • Yep - this looks like the solution, except that you do not need to specify the executable path once this is installed. Note that your default browser in crostini (xdg-open and x-www-browser) will change to the chromium install. This makes sense since the Google Chrome installation probably cannot be re-launched with a debug port on a Chromebook. The VS Code documentation does not lend much help here (https://github.com/microsoft/vscode-js-debug/blob/main/OPTIONS.md). Removing chromium does revert the browser redirect. – Michael Erickson Dec 17 '22 at 01:52