5

I have a JavaScript file that I'd like to edit and debug.

The code isn't DOM/browser/web specific.

Can I use VS Code to run and debug JavaScript without a web project like Node or ASP.NET? If so, how? Perhaps VS Code assumes it'll have a web server like Node to attach and debug

How should I modify my launch.json if necessary?

Loading a .js file and hitting F5 results in

Connection Failed

OpenDebug process has terminated unexpectedly

enter image description here

enter image description here

3 Answers 3

6

I was having the same frustrating issue. The problem is node.exe is not in your PATH. You can check this by running cmd.exe, typing node and seeing if it runs or not. If it fails, this may help you:

Hit F5 in Code. It should create / open a launch.json file. In that file, change this line:

"runtimeExecutable": null,

to this:

"runtimeExecutable": "C:\\Program Files\\nodejs\\node.exe",

A more permanent solution would be to add node.exe to your PATH variable and reboot.

Sign up to request clarification or add additional context in comments.

Comments

1

No, you can't because the debugger depends on the Node.js or io.js binaries installed and in your PATH variable. They host the code and provide introspection into it's states.

launch.json should be automatically populated, giving you a ready configuration for running and debugging.

Comments

0

yes you can debug without no web project you just need to add a debug configuration and the chrome extension

find it here https://medium.com/young-coder/setting-up-javascript-debugging-in-visual-studio-code-6c5005529987

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.