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. :)
Related
I just installed ubuntu yesterday and I just cant run any file in the output tab of VsCode (its integrated terminal). In other terminals, everything just works fine but I really want to understand, and if Its possible solve, this little problem
I already tried to reinstall both vscode and the coderunner extension. Also, Its important to mention that in some situations, the output that I got was "need to run as root or suid".
Npm, node, node-sass, and JDK are installed on the mac.
The file is compiled correctly from the console:
But there is an error in PhpStorm:
Also checked that PhpStorm sees node and npm:
What else could be the reason for the error?
he issue is that node is not on your $PATH; on MacOSX the environment variables differ between GUI applications and within the terminal. Terminal environment is only available to applications started from terminal. To solve this problem, PhpStorm tries to load terminal environment by executing some scripts on startup, but it seems that it can't retrieve all needed stuff in your case - thus the issue. As a workaround, you can try starting the IDE from terminal.
Some links you may find useful: http://apple.stackexchange.com/questions/106355/setting-the-system-wide-path-environment-variable-in-mavericks, http://apple.stackexchange.com/questions/51677/how-to-set-path-for-finder-launched-applications.. The problem is that the way to define system-wide environment variables on Mac changes from one version to another (even minor system updates may break your environment)
I am a complete newbie to all this.
I tried to install node.js 4 times and then again uninstalled it every time trying different things, thinking one of them would work.
The link to the question is-Cannot find runtime 'node' on PATH - Visual Studio Code and Node.js
After I typed $node --version in powershell terminal in VSCode (after installing node.js in C drive, defaulting to all recommended options in the setup) I get an error. I have uploaded the image of the error.
the error
Please tell me how to get node.js working with VSCode.
To get the version of Node, just type node --version in the terminal without the "$".
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.
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