'VSC: HTML language not supported or defined

Type: HTML

On a Visual Studio Code page I wrote some HTML code (I have it linked to a separate CSS file though I don't think that has any relationship to my problem), and when I click the "Run Code" button, I am presented with the message "Code language not supported or defined".

I have the language set to HTML, not "Auto Detect"

Under the error message, it says the source is "Code Runner (Extension)"

I have Disabled and Uninstalled/Reinstalled this extension and restarted VSC multiple times.

I have other extensions installed, but am not entirely sure how to use them to "Run" the code.

I have read to be "sure the executor PATH of each language is set in the environment variable," but I'm not entirely sure how I can do that.

macOS Catalina 10.15.7

VSC version 1.53.2

I have the Google Chrome and Safari browsers.



Solution 1:[1]

This is expected behavior. HTML is a markup language that defines the basic structure of a website. It is not a programming language and a HTML file cannot be compiled into a program to be run in your Terminal. Therefore, your Code Runner extension throws an error message since HTML files cannot be run in a Terminal.

I suggest installing the Live Server extension in your VS Code:

  1. Go to the Live Server extension page
  2. Click the "Install" button. It should re-direct you to open VS Code in order to start the installation
  3. Inside VS Code, open your HTML file
  4. At the bottom right of the screen, click the "Go Live" button

Go Live button

  1. Your default browser will automatically load up your HTML page. When you edit your HTML file, the browser page will refresh on itself and shows your latest changes

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 AnsonH