Meteor - Debug

meteor

How can we debug Meteor application?

  1. Stop Meteor
  2. Run meteor debug
  3. Look at the console and notice the debug port number
  4. Open Google Chrome
  5. Go to http://localhost:8080/debug?port=5959
  6. Modify the code to include the debugger keyword at appropriate place and put it inside a Meteor.isServer if block
  7. Launch another browser instance and go to http://localhost:3000/ and follow the path that you are trying to debug

Run the 'meteor debug' command in your project directory and you'll get access to Node Inspector, "a debugger interface for Node.js applications that uses the Blink Developer Tools."

node-inspector is a browser-based debugger interface for Node.js that you can use to set breakpoint, inspect source file, step through program execution, and inspect values and variables. Make sure that you are in the application's root directory and that it's currently not running.

Any WebKit-based browser is capable of running node-inspector, which means both Chrome and Safari can be used to access the debugging URL. You cannot use Firefox or IE.

Accessing the application using http://localhost:3000 is still possible in debug mode. You can open the debugger interface using http://localhost:8080/debug?port=5858

If you don't see your application starting up, go to the debugging URL and check the current execution status. If code execution is paused, you'll see a message icon at the top of the right sidebar. Click on the pause arrow at the left of the icon bar to continue program execution. The application will run as usual, but you'll now be able to use the debugging console to inspect what happens during code execution on the server.

If node-inspector doesn't seem to behave like it should, try refreshing the browser. If that doesn't work, restart Meteor with the debug command again.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License