如何在 Meteor 应用程序中调试服务器端代码 [英] How to debug server side code in a Meteor app
问题描述
我一直在努力调试我的应用程序中的服务器端代码.对于客户端,chrome 或 firefox 中的浏览器调试器就像一个魅力,但它对服务器来说更复杂
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
推荐答案
这里是我如何为 Meteer 0.5.6 管理它
So here is how I managed it for meteor 0.5.6
不再需要修改 run.js
there is no need to tinker with the run.js anymore
安装 node-inspector https://github.com/dannycoates/node-inspector
install node-inspector https://github.com/dannycoates/node-inspector
创建环境变量export NODE_OPTIONS='--debug'
运行 meteor
或 mrt
命令.它应该告诉你一些类似调试器监听端口 5858 的信息
run meteor
or mrt
command. It should tell you something like debugger listening on port 5858
调试器开始监听后,您可以启动节点检查器并将浏览器指向访问 http://127.0.0.1:8080/debug?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
我玩得很开心:-)
对于meteor 1.2.x 及以后的版本,一切都被打包了.只需运行meteor debug
并连接到提供的url
For meteor 1.2.x and onward, everything is packaged in. Simply run meteor debug
and connect to the provided url
这篇关于如何在 Meteor 应用程序中调试服务器端代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!