I have been struggling to debug the server side code in my app. For the client, the browser debugger in chrome or firefox work like a charm but it is more complicated for the server
So here is how I managed it for meteor 0.5.6
there is no need to tinker with the run.js anymore
install node-inspector https://github.com/dannycoates/node-inspector
create an environment variable export NODE_OPTIONS='--debug'
run meteor
or mrt
command. It should tell you something like debugger listening on port 5858
Once the debugger is listening, you can start node-inspector and point your browser to Visit http://127.0.0.1:8080/debug?port=5858
I had a lot of fun with it :-)
For meteor 1.2.x and onward, everything is packaged in. Simply run meteor debug
and connect to the provided url
In this video Slava Kim explains how someone can debug a Meteor app at server side. First you have to install node-inspector
npm install -g node-inspector
and then run the Meteor app with a specific variable
env NODE_OPTIONS="--debug" meteor
in new terminal tab open the node-inspector by run the command
node-inspector
copy and paste the url from node-inspector on Chrome and you will find all the server side code to set breakpoints for debug. Important: Set the breakpoints on your project's files at the (no domain) folder
I use both Node-inspector and Loggly to debug my Meteor server.
Node-inspector is AWESOME but if I have testers telling me about issues or issues happen in production, it doesn't tell me about EXACTLY what they did or what hardware/network conditions they're on. Logging however can tell you about the step & conditions that caused an issue which allows you debug with better information.
As of Meteor 1.1.0.2, meteor debug
does the trick on Meteor 1.1.0.2.
See more info here.
来源:https://stackoverflow.com/questions/14909610/how-to-debug-server-side-code-in-a-meteor-app