How can I debug my Meteor application using WebStorm IDE?

Can someone provide a short list of steps for connecting a Meteor application to the WebStorm debugger, please?

+17
debugging webstorm meteor remote-debugging
Feb 07 '13 at 12:26
source share
6 answers

WebStorm is the only IDE with native Meteor server code debugging support - check out this video . Even on Windows, debugging is very simple:

WebStorm 9+

Go to Run -> Debug -> Edit configuration ..., click the plus sign, click "Meteor". You can add an environment variable such as ROOT_URL if you need to.




WebStorm over 9

This answer is retained for historical purposes only. You should update WebStorm.

In older WebStorms, you had to create a Node.js debug configuration.

  • on the server, export the NODE_OPTIONS=--debug=47977 environment variable. For example,

     NODE_OPTIONS=--debug=47977 meteor # Linux/Mac set NODE_OPTIONS=--debug=47977 & meteor` # Windows 
  • Create a WebStorm / PhpStorm launch / debug configuration using the port above (47977) and the server host. Leave 127.0.0.1 if you are debugging locally.

Run -> Run / Debug confioguration

  • in WebStorm, Run -> Debug <myapp>, or press Shift + F9. Make sure you see "Connected to <your host>" in the Debug panel

Now you can set breakpoints, access local variables, etc.

To debug the client, simply use the Chrome or Firebug debugger.

Troubleshooting

  • Process disconnected unexpectedly - this happens when a meteorite starts automatically due to the lack of specific support for the Meteor. Just run -> Debug <myapp>, or press Shift + F9 again.

  • you cannot connect to the server - make sure that the firewall rules allow incoming connections to any port that you selected for the Node.js debugger (47977 here).

+22
Feb 05 '14 at 7:36
source share

Other answers are now outdated. Do not add Node.js debugging configuration as described above, or worry about spyjs.

If you use Webstorm 9.0, it is as simple as in Run β†’ Debug β†’ Edit configurations ..., click on the plus, click on the Meteor.

WebStorm may also ask you to install a browser add-on, but only for the client part of the debugging; just add a breakpoint to the server side code and you will see that it works out of the box.

JetBrains updated the video that was linked to in Dan Dascalescu above, and it shows you the process that I just described.

+10
Jan 25 '15 at 6:30
source share

For applications using webpack:webpack , using the WebStorm Meteor debug profile does not seem to work.

My setup uses webpack:webpack v1.0.12, Meteor v1.3.0 and WebStorm 2016.1, but it will probably work with later versions (note that the fix for this problem only was released in version 1.0.12, so earlier versions probably not work with this procedure).

Here is what I did to make it work:

  • Create a webpack.json file in the root of the project.

    It should include a devtool configuration that generates source maps that help debug. The rest can be changed according to your specific setting.

     { "root": "src", "devServer": { "host": "localhost" }, "devtool": "source-map" } 
  • Create a debug setting:

    Node.js Remote debugging, port 5858 (port is configurable).

    remote node debug configuration

  • Run meteor debug

    You can specify a port using --debug-port <port number> .

    See meteor help debug details.

    meteor debug first run

  • Connect WebStorm to the debugger

    • run the debugger click
    • a status message should indicate that it is connected. Scripts should be available on the Scripts tab. the debug panel should indicate that it is connected
    • the server should work in the console server must resume execution
  • Hit your breakpoints and rejoice.

+4
Mar 31 '16 at 12:26
source share

WebStorm 9 will support Meteor. While WS 9 has not yet been released (as of October 7, 2014), there is an early access program for WS 9 .

Read the JetBrains WebStorm blog, which describes some of the Meteor support features and includes a short video.

I am new to Meteor, WebStorm (and JavaScript, for that matter), and have been using the WS 9 EAP 138.2406 build for several weeks. I can start my project from the IDE, set breakpoints, go through the code, check the values, go to the definitions and complete the release. It is very useful.

+3
Oct 07 '14 at 20:01
source share
0
Nov 14 '14 at 1:22
source share



All Articles