Skip to content
Advertisement

Problem using VS Code’s Code Runner to run js file

I’ve installed the vs code extension Code Runner to help me learn JS, but it doesn’t seem to be working. When I try to run this simple console log, I get no output in vs code terminal, just this message: “[Running] node “c:UsersvaioDesktopreactscript.js” and nothing else, not even the massage saying that the execution ended.

At the same time, if i use windows cmd and use “node script.js” it works perfectly fine.

The code for the script.js is just:

console.log("Hello, World")

Can someone help me? (let me know if i have to share any other files)

Answer

You don’t need Code Runner to run JavaScript in VS Code as VS Code is written in JavaScript and has a built-in JavaScript interpreter. Remove the extension, load your JavaScript file, and then click the play arrow button in the top-right of the window, or type CTRL+ALT+N.

Advertisement