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

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

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.

GitBash - can't enter a new command after starting npm

The solution to my problem may be simple but since I'm a beginner on command line and npm it's been hard to solve it by myself, hopefuly you know the solution:
I cloned a repository and then started npm in the command line. After I enter the command 'start npm', it shows in console that webpack was succesfuly compiled but after no matter what I input, the command line does not execute anything neither shows an error message. I've tried to input, as I've done before, a new command but it seems to add text and not a command. (see the picture)
Or if it is not a problem and i'm just misunderstanding something, please tell me.
After I enter the command 'start npm'
Judging by the image you provided, this command is starting the Webpack dev-server. This is a web server for testing your application, which will monitor your files and rebuild your app when any changes are detected. Once the server is running in a terminal, any further input on your part will be ignored. You can stop the server using Ctrl + C.
Or if it is not a problem and I'm just misunderstanding something, please tell me.
The server instance will (in its default configuration) be listening for connections from localhost on port 8080, so (depending on how your app is set up), it might now be enough to visit http://localhost:3000 in your browser to see your project running. If that's not the case, check the output in the terminal window for something like: Project is running at http://localhost:3035/
It might also help to have a look in package.json to see what else (if anything) npm start is doing.
Further reading: https://github.com/webpack/webpack-dev-server

PhpStorm terminal npm (node)

I've just recently started using gulp.js in my projects and I've been trying to learn and use terminal a lot more.
When I run npm commands from the mac terminal default console everything works great however when I run the same commands in PhpStorm the command is not found.
I've followed PhpStorm's guides on installing and integrating the NodeJS plugin etc but I cant seem to get any of the commands to work through it even though its in my usr/local/bin and was installed globally etc.
When I SSH to vagrant though I can use the npm commands etc. Would anyone happen to be able to suggest anything?
This one is quite old but I came across the same problem.
What I did was enter the terminal settings under tools > terminal, go to Application Settings, and change the Shell path to the one you need.
Click the ... button and select the one that suits you.

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.

node.js command prompt not initialised as expected

I installed the .msi file from nodejs website and installed it.
Now, when I run nodejs.exe, I do get a command prompt, but it shows a blinking > by default, instead of C:/>
It looks somewhat like this:
What to do?
This is called the REPL. You can enter statements for Node to execute and get realtime feedback. Ctrl+C twice will get you back to the command prompt.
I recommend checking out the answers to How do I get started with Node.js for learning more about Node.js and how it works. Typically you provide a file with your Javascript for Node to execute:
node app.js
or you can leave the .js off:
node app

Resources