javascriptvscode-code-runner

Error when trying to run JavaScript code in Visual Studio Code using the Code Runner add-on


While trying to run Javascript code in Visual Studio Code using CodeRunner addition, I get the following error in the output:

"[Running] node "c:\Users\Daniil\Desktop\3 + 2.js"
"node" �� ���� ����७��� ��� ���譥�
��������, �ᯮ��塞�� �ணࠬ��� ��� ������ 䠩���.

[Done] exited with code=1 in 0.02 seconds".

I have installed node.js previously, so when checking the installation through Windows Powershell using the "node --version" command, I get the output "v20.12.2".


Solution

  • If you installed node while vscode was open, you should kill the instance of vscode and restart it again.

    Also i tried doing this using node 18.17.0

    [Running] node "f:\xampp\htdocs\3 + 2.js"
    5
    
    [Done] exited with code=0 in 0.071 seconds
    

    If nothing works you can install the recommended version of node, or else you can always run javascript writing in the terminal node <filename>.js