Adding a preTask to launch.json command hides console output - node.js

I want to create a task to debug a node proces.
For that it should start a build task.
So I add:
preLaunchTask": "npm: build:main",
On launch, I get the notification that this terminal will be reused by tasks and closing any button will close it.
When I do close it, I do not get a terminal with the debugging output. I only get my regular terminal back.
So I removed the task and launched again to see what happens.
Now no terminal at all opens up and I still only have the default terminal.
Is this a bug or am I doing something wrong?
Note:
presentation is not set in the launch.json command.

Okay this answer fixes it. Adding this to the launch command shows the console again:
"console": "integratedTerminal",
It is weird that you need to specify the console implicitly in this case.

Related

Unable to attach node debugger in current version of VS code

I updated VS code to version 1.59.1 and Node debugging no longer works-- I was on a July 2020 build before today. I use nvm to toggle between versions and my nvm default is Node 12.22.
If I run 'node --inspect-brk...' (which I used to do) in a VS code terminal things just hang with a 'debugger listening..' message. If I run 'node --inspect' the program runs, also with a 'debugger listening..' message but no breakpoints are respected. (What's the difference by the way, between inspect and inspect-brk?)
After installing the latest VS code and opening it a dialog appeared saying Node 10 is in my path and so auto-attaching would no longer work. And yes, Node 10 is part of my nvm options, but I'm using Node 12 now via nvm. (That dialog no longer appears now when I open VS Code, for some reason.)
I have the VS code 'auto attach' setting set to 'only with flag'. I've tried the 'always' option too but no luck. I've closed and reopened VS code numerous times to see if a changed setting will work but it hasn't so far. If anyone knows something I may have missed or knows what's what, I'm happy to hear suggestions.
A couple things you can try when the auto-attach doesn't work:
set auto-attach to disabled, then back on 'with flag'
check with env that the NODE_OPTIONS environment variable looks something like:
NODE_OPTIONS=--require /home/me/.vscode-server/data/User/workspaceStorage/dc520ffe0268148fad350d767ccf9350-1/ms-vscode.js-debug/bootloader.js
If not, then it helps to restart your vscode terminal, your bash, etc, until it does.
--inspect-brk tells NodeJS to wait for a debugger to attach before starting the program.
--inspect enables debugging but doesnt wait for a debugger
With vscode's auto-attach, you should use --inspect. It will attach automatically as soon as the program starts.

Debugger in PyCharm doesn't run

When I start my project and tap Shift+F10, PyCharm open console with "/usr/bin/python3.7". Code doesn't running, even if I reboot Linux.
I changed interpreter to System, then on Virtual but it doesn't change anything
Ok, I have switch some options in "Debug Configuration"
Exactly I edit script path to the main.py
On picture I emphasize by mouse, what I exactly changed
https://cdn1.imggmi.com/uploads/2019/6/17/ab0f2c97212b8315b39b46eece86c1db-full.png

PyCharm: Executing the script in the console rather than 'run'

By default, all scripts in PyCharm seem to execute in a separate python interpreter called "Run", which, as far as I can make out, is pretty much independent of the IPython console running alongside. Now, to execute any snippet of the script after the whole thing has been run, I can copy-paste into the Run pane, but this is not ideal as it is not an actual python/ipython console. If I want to execute in the console, I will need to run the whole thing again inside the console (and not just a snippet) because the console doesn't seem to recognize/store any of the variables when it was run, which is tedious.
I've searched for a solution, but the closest I got was to enable "show command line afterwords" in the Run Configurations. This just seems to throw up an error on the lines of "file not found", which makes no sense. I'm running my script through SSH into a remote server, if that helps.
Go to run --> edit configurations...
towards the button you'll see a checkbox that says "run with python console"
make sure its checked
try to edit the run config, via run -> edit configuration.
And check the path of the working directory or the script directory.

Node Inspector Console - Can't Execute Command, Goes to Newline Instead

I am running node inspector and trying to run commands in the console.
However, I cannot run them. Instead of running, hitting enter goes to a new line.
Using any other console in chrome works fine, just not Inspector's.
Have tried restarting node and inspector. Any ideas how to fix this?
It seems like Chrome v54, v56 are having this issue for both mac and windows. The easiest solutions so far is downgrading your chrome to v51, and I think some one is working on a PR to fix this.
You can download V51 from here
http://google-chrome.en.uptodown.com/mac
===========================================================================
Another work around is to use command
node --inspect --debug-brk index.js
After running that, goto chrome, open
chrome://inspect you will see a page like this
Find the target and click the inspect, a debugger will be attached automatically and everything works from there. Just like it used to be in node-inspect, and the console works!
read this for more information
http://www.mattzeunert.com/2016/06/01/node-v8-inspector-inspect.html

Nodeclipse debugger ignoring breakpoints

I'm using Nodeclipse 0.10 with nodemon, but when I try to debug my script it doesn't stop at any of my breakpoints. I've already seen this and this answer but it hasn't helped.
Occasionally, it will stop on the first line of nodemon, other times it gives me a timeout error from the V8 VM, and sometimes it doesn't do anything at all.
Here's what I've tried so far:
I tried both the "Node application" and the "Node with monitor", neither one works.
Removed nodemon from the preferences page, but then Eclipse just complains it's missing the nodemon path and won't start my script (even if I select "Node application")
Ran node --debug-brk=5858 from the command line and then tried to attach the Eclipse debugger to it
Tried launching the debug from the toolbar button (my personal default) as well as from context menu after right clicking the script file - that just makes it stop on the module.exports line of the script
Ran eclipse --clean
None of it works. As a side note, I did not install Nodeclipse into a new Eclipse environment when I installed it, because it took me a long time to configure my existing one to where I liked it, and I'd rather be able to keep that.
Anyone dealt with this issue before?
Ok, this was embarassingly stupid...somehow, "Skip all breakpoints" had become activated in the Run menu in Eclipse. It's working now.
Thanks everyone for the help though. :)
There is already version 0.11, that has some improvements. You can try it within Enide Studio 2014. But of course, it does not matter whether it is fresh new or updated Nodeclipse version.
You should have paid attention to Nodeclipse Console messages, especially when there are question. You would what actual node command is executing. And I guess there won't be --debug-brk=5858.
Right-click on the launched file, select Properties or press Alt+Enter,
then if in Run/Debug Setting you see 2 or more Launch configuration, delete all or some. They are created automatically during first launch (with message in Nodeclipse Console)
I am currently Nodeclipse project lead, but I don't continue with nodemon support, as I am not using it. I would appreciate feedback, research and suggestion on how to improve that flow.

Resources