Server debugging with Meteor
Often there are times where you need to debug the server side when it is not possible to dive into debugger
on the client. This has been made easy with node-inspector: you'll have it installed a setup within a flash.
First of all install node-inspector:
npm install -g node-inspector
Next, ensure that NODE_OPTIONS
is set to use --debug-brk
:
export NODE_OPTIONS='--debug-brk'
Now when you start up your meteor server, you should see something like "debugger listening on port 5858". If that's the case then just run node-inspector in another shell:
node-inspector
Standard output should read something along the lines of "Visit http://127.0.0.1:8080/debug?port=5858 to start debugging."
And that's it! You should be all set up and good to go. One thing to note is when you've made a change in your Meteor's project file and it pushes a hot reload to your browser, you might need to manually reload the node-inspector webpage (at the address specified from your standard output) to see that its paused in main.js
.
Written by Tom Sabin
Related protips
1 Response
Errors in-browser with: "Can not open /debug".