I have a nodejs application and its working with socket.io
I have the currect configuration in webstorm
when running the application it works and show in console: info - socket.io started
but when starting application in debug mode, wont show this line and socket does not start
whats the problem?
evebn thought I have nodemon and in nodemon this happens the same
Related
I am running node --inspect app.js inside of a docker container.
In the console I see Debugger listening on ws://127.0.0.1:9229/0b4d64ac-90c1-480d-a98a-7061c0b49189
How can I debug using WebStorm? I know on a previous version of node there was --debug I would then connect using the Node.js Remote Debugger.
To attach to remote Node.js app started with --inspect/--inspect-brk, (Node.js 7+), you need using Chromium Remote run configuration.
See also https://blog.jetbrains.com/webstorm/2017/09/debugging-node-js-apps-in-webstorm/, https://www.jetbrains.com/help/webstorm/running-and-debugging-node-js.html#node_docker_run_debug
I'm trying to set up a run configuration to start Javascript debug & debug of my frontend at the same time. It is possible to start both debug sessions manually and it works. But I have to do this after every change.
It would be nice to have them both restarted in debug mode. I can set the server to run before the js debug in the run config, but this waits until the server is stopped to start the js debug.
I also tried to set an npm config. This works because I use pm2 to start the server in background, but not in debug mode.
Thanks for your Help
If you are using Node.js run configuration to start your server, you can use Browser/Live Edit tab to start client-side debugging on starting your server: just specify your application URL there and check both After launch and with JavaScript debugger options
If you start your server with NPM script, your only option is using the Multirun plugin for running both npm start and JavaScript Debug run configurations concurrently
tl;dr: Getting "Debugging connection was closed. Reason: websocket_closed.
" when trying to debug using Chrome Dev Tools with Node.
I want to do some code-stepping of a Node app. I thought I'd give Chrome Dev Tools a try.
I'm having a few issues that are preventing me from using CDT, and I'd appreciate any help.
1) When I do the following commands in Terminal
node --inspect myFile.js
or
nodemon --inspect myFile.js
the server seems to start fine, but when I pull up the CDT Node tools through
about://inspect
nothing appears in the CDT Node debugger, no sources, nada. If instead I access the tools by pasting in the URL that the above commands produce in the terminal into Chrome -- something like
chrome-devtools://devtools/remote/serve_file/#521e5b7/inspector.html?experiments=true&v8only=true&ws=localhost:9229/node
I get in the CDT Node debugger an announcement
Debugging connection was closed. Reason: websocket_closed.
What gives?
2) When I add the flag "--debug-brk" thusly
node --inspect --debug-brk
the server doesn't even start normally.
I'm using MacOS 10.12.4, Node v6.3.1. The server is running on port 9999, there is a client app that hits the server on that port, the client app runs on port 4200. I'm trying to debug the server code here.
(By the way, if you have another better tool than CDT to recommend for debugging Node I'd be keen to hear of it -- I have WebStorm but the process to debug Node seemed more complicated than that for CDT.)
Any help much appreciated --
Perhaps it was the weather? : following the same procedures as before, same code, I've gotten the CDT to work with the app I wanted to debug. The warning
Debugging connection was closed. Reason: websocket_closed.
was signaling that the app had stopped and thus there was no connection open.
I have a node app locally and I normally run it using the run button in the web storm, which works fine. While I am documenting the project I came across this blocker: if I try running the same app through the terminal using the command: node app.js , the server starts but the browser throws and error stating "This site can’t be reached" "localhost refused to connect".
Because the port is occupied.
You can change it using app.listen({port})...
or
linux:
export PORT=4500
node server.js
windows:
set PORT=4500
node server.js
I found this myself.. since I used the scaffolding app and it stores info related to server at bin/www, so we will not be able to run the app using the command : node app.js but instead we could run the app using nodemon(which I installed globally on my machine)
Love nodemon for this awesome feature <3 :)
I am trying to debug a very simple script using "node-inspector".
I tried both following instructions on the repo, which include running "node-debug" and instructions here which include running "node --debug-brk yourApp.js".
The main problem is that neither of the commands "node", "node-debug" or "node-inspector" return any result. They just return silently.
Running "nodejs --debug-brk myScript.js" on the other hand works, but does not seem to have a nice debug GUI. I can connect to it on http://127.0.0.1:5858/ but it is hardly useful for variable inspection.
Once you've installed node-inspector globally (with npm install -g node-inspector) you can use it to connect to a nodejs process that's been run in debug mode. Try the following steps.
Open two terminal windows
In the first, run your process you'd like to debug with node --debug-brk myscript.js
In the second, run node inspector with node-inspector
In Chrome, visit the following address: http://localhost:8080/debug?port=5858
What you've done here is start node in debug mode (at port 5858 by default), then launch node inspector, which runs its own webserver on port 8080. The URL (the debug?port=5858 part) is telling node-inspector to connect to the node debug process that's on port 5858. Once you're in there, you'll see that your process has stopped on the first line (as instructed to by --debug-brk). You can then set any other breakpoints you'd like, then press the "play" button to start your process running!