How to debug Node with Grunt from webstorm - node.js

I have been using grunt in my project and I wanted to be able to debug the code using web storm.
How do I open a debug port in node JS?
When trying to use the remote debug a nodeJS option the IDE hangs on trying to debug...
When trying to control node from within webstorm I followed this question
I am getting:
\nodejs\node.exe \grunt server
Process finished with exit code 99.
Any ideas?

Try removing the 'server' application parameter.

Related

Vue JS Intellij setup

I am working on a Vue js application but am having difficulty getting it to run/debug within IntelliJ. I am currently running it from the command line but I'm interested in getting it to debug in IntelliJ. Not many tutorials out here on getting this set up to work. Is there anyone that has experience in setting up this framework and IDE?
Steps are rather straightforward and described in blogpost:
First, install the JetBrains IDE Support Chrome extension. This will bind the browser debugger environment with IntelliJ in real-time.
start the server with npm serve (can be done from a gutter in package.json):
create a new JavaScript debug configuration, specify the URL your app is running on (usually http://localhost:8080) in it, put the breakpoints right in the source code, and start the debug session.
See also https://blog.jetbrains.com/webstorm/2019/03/get-started-building-apps-with-vue-js-in-webstorm/ for some hints on working with Vue.js in IDEA. And https://medium.com/dailyjs/stop-painful-javascript-debug-and-embrace-intellij-with-source-map-6fe68eda8555
You can add "Run Configuration" for any project to run in Intellij. For this, you must have a run script in package.json.
Refer below link for a screenshot. NPM Run Configuration Sample:
Choose NPM and give like this. Once done, you are all ready for clicking the RUN button available in the toolbar to run the project

Debugging node app in WebStorm when run from gulp

I am using webstorm 10.0.2 and have used the bangular yeoman template to generate a project. I can run the gulp commands via the gulp window, and I can set a breakpoint in the gulpfile.js and it will hit it, but I can't seem to get it to hit a breakpoint in my server.js
It looks to me like the gulp file is launching another instance of node and thus when you do "debug" from webstorm you are just debugging the gulp.
I also tried with another project using yo hottowel but get the same thing - I am unable to debug the actual application through webstorm.
Can anybody tell me how to configure webstorm so that I can debug the actual server side node code but still use the gulp build tool?
I contacted JetBrains support back in May 2015 and their response was:
It seems this cannot be done quickly. In short, the problem is that serve-dev task starts new process (nodemon) that takes app.js
There is no workaround how to debug such spawned processes right now. We would really appreciate if you'll submit a feature request about it in our YouTrack: https://youtrack.jetbrains.com/issues/WEB
The only way you can try to avoid it - try to create a separate task that will run app.js directly without nodemon process and debug this task instead.
It seems the best option is to use https://www.npmjs.com/package/gulp-node-inspector

Issue with Node-based Cordova Hook

I'm playing around with the Cordova hooks capabilities and I'm trying to test using a node application as a hook. In this article: http://devgirl.org/2013/11/12/three-hooks-your-cordovaphonegap-project-needs/ it references running node applications, so I know it's possible.
I've created a simple node application that I'm using to test the before prepare and after prepare process:
#! /usr/bin/env node
console.log("this is a node module");
When I run my prepare, I get the following error:
C:\Users\jwargo\dev\lunchmenu>cordova prepare
The system cannot find the path specified.
Hook failed with error code 1: C:\Users\jwargo\dev\lunchmenu\hooks\before_prepare\test.js
I can't find any information anywhere about what an error code of 1 means here.
I've tested the node code and it runs fine with "node test.js" and when I execute test.js from the command line Windows simply launches my default editor.
So, can anyone tell me what I'm doing wrong or what I need to do to be able to execute a node application as a hook with the Cordova CLI?
Figured it out with some help from the Cordova dev team. The space in my shebang was causing the problem. I removed it and the problem went away.

Node.js server debuging with WebStorm (grunt)

I'm using grunt to launch my server with livereload and other tasks.
I've followed this and this post to run my grunt tasks.
It's working but I can't debug properly (when I set some breakpoints, there aren't hit)
When I launch the script, here is what I got:
As you can see the debugger appears in a 2nd tab, but it's not doing anything. (even if it says it's connected successfully).
To debug my app I've to stop this 2nd tab, and run a remote debugger... Anyway to fix this?
Additional info: The server is run in another process. If I run it in the same process as grunt, there are no issues.
What Node.js version do you use? In 0.10.x the child process occupies the same port as a master process, so debugging won't work by default. Related ticket: https://github.com/joyent/node/issues/5318. Can you check if it works for you using Node.js ersion >= 0.11.4? Also, what Grunt tasks are being used?
As mentioned by lena, the issue seems to be fixed in WebStorm 8.

ruining EasyRTC server using iisnode

EasyRTC is one of the best available opensource WebRTC solutions that runs in node.js! I have manged to run it on node.js on my system but my application is in Asp.net so I've been trying to run it using under IIS using iisnode! but for some reason I haven't been able to make it work! running this application in node.js i use node server.js to start the server but in IIS when i set the default page to server.js to start the application it wond work!
this is result by using
nodejs:
nodejs result: (working properly)
IISNODE Result:
looks like it's not even running it !
This error is due to lack required module for easyRTC. type in node command prompt "npm install" It will install all dependency module. And after that try to run server. I hope It will work for you.

Resources