Home > database >  How to get output of the JS file using VS Code
How to get output of the JS file using VS Code

Time:01-22

When I run the code, nothing shows in "Output" tab. I installed nodejs as well as Code runner extension. How to fix this issue? the top menu

and this is the terminal:

enter image description here

--

and you don't need a code runner extension, every time you want to run your JavaScript code, write the command

node YOUR_FILE_NAME.js

Otherwise, if you want something to automatically detect the changes you make to your file and automatically run the code when you save the file, you'll need a package like nodemon.

to install nodemon, in the same working directory, open up the terminal and write the following commands:

npm init -y

and then:

npx nodemon sample_1.js

replace the sample_1.js with your file name

Nodemon will keep running in the background and every change you make to any of your files in your working directory will make nodemon reload, and you'll see the changes in the terminal immediately.

CodePudding user response:

I fixed that issue. I installed JavaScript Debugger(Nightly). After that now OUTPUT tab shows output of the js file. https://marketplace.visualstudio.com/items?itemName=ms-vscode.js-debug-nightly

  • Related