playing around with the newly released VSCode Editor/IDE.
I wanted to try out debugging on a very basic Node.JS CLI application, which uses the "prompt" npm package:
prompt.start();
prompt.get(schema, function (err, result) { ...
When I set some breakpoints and start the app debugging, VSCode just steps over the prompt.get() and hangs in the debug process until I force to stop it, which ends in an error "OpenDebug process has terminated unexpectedly".
I expected VSCode to open up a shell that I can interact with.
My guess is that it's just not implemented the right way yet, but probably I just couldn't figure it out...
On Linux Visual Studio Code does not yet open a terminal for the program to be debugged, so there is no way to interact with it through the command line. As a workaround you can launch the node program from a terminal in debug mode and attach to it from VSCode.
I have created a bug on our side and will make sure it’s fixed with the next release.
Andre Weinand,
Visual Studio Code
Related
I'm working on Mac and I cannot change node version from terminal window in VS Code
What's interesting, when I open iTerm I have no problems with switching versions. So the problem only seems to appear on VS Code.
Any idea why and how to solve it?
vscode has a shell integration, which you can configure. e.g. placing the following configuration in your vscode settings
"terminal.integrated.shell.windows": "C:\\Windows\\System32\\cmd.exe"
or you can use the shell launcher plugin, which supports launch multiple shell configurations in the terminal.
I know there are various questions about the nodejs version used by Visual Studio Code, but none of them helped, and I noticed a very peculiar discrepancy:
If I run terminal inside vscode, I see the new version of node:
But as soon as I launch the debugger (F5), it invokes an old version of node:
I've already checked, and I am not specifying runtimeExecutable or runtimeVersion in my launch.json (and I prefer not to).
In desperation, I tried deleting /opt/node-v8.12.0-* and then F5 resulted in the error: Cannot find runtime 'node' on PATH -- but clearly it can in the terminal!
So how is it possible that vscode finds two different versions of nodejs?
Aha! While I was closing my VSCode window between attempts, I wasn't closing every VSCode window on my system (even on multiple workspaces.)
Presumably VSCode (I'm using 1.40.2 on Linux) detects the location/version of node on initial startup, and it doesn't detect new installations of node unless you shut down all instances of vscode (close all windows, or more severely, killall code.)
That's an hour I'll never get back, hope this helps someone else. :)
my webstorm debugger works fine if I simply run, say, my server.js directly in debug mode.
However, when I run an NPM script in debug mode (npm start for instance), I get the following exception:
Process finished with exit code -1073741510 (0xC000013A: interrupted by Ctrl+C)
I use Webstorm WebStorm 2016.1.2
Build #WS-145.971, built on May 1, 2016
JRE: 1.8.0_77-b03 x86
JVM: Java HotSpot(TM) Server VM by Oracle Corporation
My Node version is 5.11.0
I run it Windows 7, my colleague is running Windows 10 with same problem.
Did anyone come across this problem yet?
there could be many reasons for this - here are just some of my thoughts which may be useful to someone:
maybe some problem of the IDE: e.g. in this case caused by old watch variables
try to clear the ide/debugger state: e.g. delete breakpoints, watches, etc.
try: Invalidate caches / Restart
maybe just an early exit
I had one case in our node-tests, where some part of the code just called process.exit(0) before the async test-function had finished. This also caused the (confusing) console output:
Process finished with exit code -1073741510 (0xC000013A: interrupted by Ctrl+C)
When I use visual studio code to debug a nodejs app.
visual studio code tell me request 'launch': cannot launch target (reason: spawn node ENOENT)
My nodejs version is 4.2.4
Managed to get past this when running on Windows by specifying npm.cmd instead of npm in the VS code debug configuration like so
"runtimeExecutable": "npm.cmd",
Some discussions are posted in this here
How do I debug "Error: spawn ENOENT" on node.js?
Especially, the following points should be checked
Ensure the environment variable PATH is set
PATHEXT environment variable that can cause certain calls to spawn to not work on Windows.
I was getting this error on a Debian Linux system. I noticed the same thing worked OK on Windows.
Next I noticed that the Node.JS executable is called node on Windows but on Debian (and on Debian-based systems such as Ubuntu) it's called nodejs. So I created an alias - from a root terminal, I ran
ln -s /usr/bin/nodejs /usr/local/bin/node
and this solved the problem.
This usually happens if you already had your Visual Code Editor running while installing node js on Windows OS. I would advise you to shut down your Visual Studio Code and restart it. This problem should go away.
If not do a machine reboot and verify if the debug works flawlessly
Can anyone help me please onto this issue. I have just installed webstorm 8 and trying to create a Node.js-express application and getting following error. It pops a node window but shuts it off within milliseconds. Also if i am trying to create a node.js project manaully, i cannot debug node.js it says "Process finished with exit code 0" . Please note if i try to run node from command prompt it is running fine. I am using windows 8
Try choosing node.exe instead of nodevars.bat as Node executable
Try to update your ide. Its working on my case