如何调试koa
发布于 7 年前 作者 jeffzhong 5323 次浏览 来自 问答

一直用node-inspector调试,但koa没法调啊 屏幕快照 2017-02-04 14.42.56.png

15 回复

你这个过时了

@yangchongduo 刚刚启动就显示的,websocket不可能就过期,连续刷了好几遍都这样

@i5ting 不喜欢vscode

@jeffzhong 何苦难为自己,工具而已,好用就用,那试试devtool去

@i5ting 一直都用sublime text,不想再换ide了,老换来换去的,何苦又为难自己。

node --debug-brk --inspect app.js

找到 chrome-devtools://devtools/remote... 复制到 chrome 打开即可调试, 不需要 node-inspector

@magicdawn 这个要装什么东西吗,试了下,chrome-devtools://devtools/remote… 打不开

@magicdawn 按着这个https://blog.hospodarets.com/nodejs-debugging-in-chrome-devtools?utm_source=javascriptweekly&utm_medium=email,终于搞定了

@jeffzhong 哦, 这种方式更进一步

Recently Paul Irish described how you can debug Node.js applications with Chrome DevTools.

Since that time Chrome DevTools have evolved and the step, where you had to open the separate page with a specific URL to debug the Node.js code, was removed.

It means, today you can debug your browser JavaScript files and Node.js ones in the same DevTools window in parallel, which makes the perfect sense.

Let’s take a look how it works.

启用 Experiments 的目的是 debug browser js & node.js 同时. 如果是纯后端的话, 使用 chrome 打开就好

另外推荐一个electron包装的devtool,也非常好

https://github.com/Jam3/devtool

回到顶部