有人知道调试服务器端代码的好方法吗? 我尝试启用 Node.js debug,然后使用 node-spector,但它没有显示我的任何代码。
I end up using console.log but this is very inefficient.
更新: 我发现以下过程在我的 Linux 机器上运行正常:
当您运行陨石时,它将产生两个进程
Process1:/usr/lib/meteor/bin/node/usr/lib/meteor/app/meteor/mete.js
Process2:/usr/lib/meteor/bin/node/home/paul/code/bbtest _ code/bbtest02/. meteor/local/build/main.js —— keepalive
你需要在进程2上发送 kill-s USR1
运行 node- 检查器,您可以看到您的服务器代码
在第一次尝试时,我将/usr/lib/meteor/bin/meteor 中流星启动脚本的最后一行修改为
exec "$DEV_BUNDLE/bin/node" $NODE_DEBUG "$METEOR" "$@"
并在命令提示符下运行 NODE_DEBUG=--debug meteor
。这是 process1上唯一的 put —— debug 标志,所以我只能在 node-spector 上看到流星文件,而且找不到我的代码。
有人能在 Windows 和 Mac 机器上检查一下吗?