VScode Solution for Code runner not supported or defined

In this short tutorial, You will learn how to configure a language for Code runner and also a solution for Code runner not supported or undefined errors.

Visual studio code supports almost all programming languages as languages🔗

In my vscode, I create a javascript file and tried to run with an option( Right click + Run code or shortcut Ctrl + Alt+ N), got an error as follows

Code runner not supported or undefined vscode

The problem is that VScode is trying to run a javascript file code runner that does not support these files.

Visual studio code has an inbuilt code runner extension that supports all major programming languages java, javascript, typescript, etc.

Solution to fix code language runner not supported or defined for javascript

First, Go to select language mode in vscode at, Right bottom of 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 same issue occurred for other languages or file formats, Please make sure that install the extension for languages and follow the same steps.

Another way is to add javascript with File associations in settings.json

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

Finally, You can open the terminal and run the below command.

node filename.js

It runs javascript successfully.

Conclusion

In this short article, You learned how to fix code language runner when running javascript code in visual studio code.