VScode Solution for Code runner not supported or defined

In this brief tutorial, you will learn how to configure a language for Code Runner and find a solution for Code runner not supported or undefined errors.

Visual Studio Code supports nearly all programming languages, as outlined in the languages🔗 overview.

Code Runner is an extension that allows you to execute code in various programming languages within Visual Studio Code, providing a quick and straightforward way to observe the results.

Now, let’s explore how to run code using Code Runner.

In my VSCode instance, I attempted to run a JavaScript file with the option (Right-click + Run code or the shortcut Ctrl + Alt + N) and encountered the following error:

Code runner not supported or undefined vscode

The issue stems from VSCode attempting to run a JavaScript file, which Code Runner does not support by default.

Visual Studio Code has a Code Runner extension that supports major programming languages such as Java, JavaScript, TypeScript, etc.

To resolve the Code runner not supported or undefined error for JavaScript.

Check and verify Code Runner Extension

  • Ensure the Code Runner extension is updated to the latest version.
  • Consider reinstalling the Code Runner plugin for VSCode and verify its extension.
  • Check language support for various programming languages to confirm that Code Runner supports the target language.

After these checks, verify the issue by running the code using the following steps.

Change the language

  • Go to the language mode selection in VSCode at the bottom right. It opens the language mode screen as seen below
Code runner not supported or undefined vscode
  • Choose either Auto Detect or select language, in this case, Javascript
  • Save the changes.

If the issue persists for other languages or file formats, ensure that the corresponding language extensions are installed and follow the same steps.

Alternatively, add JavaScript with file associations in settings.json

"files.associations": {
    "*.js": "plaintext"

Finally, open the terminal and run the command

node filename.js

Or using code runner in VSCode

Right-click on a editor and click + Run code or use the shortcut Ctrl + Alt + N to run the code. This successfully runs JavaScript.


In this concise article, you learned how to address the “Code runner not supported or undefined” issue when running JavaScript code in Visual Studio Code.