Egg: chrome devtools调试无法找到自己写的代码

Created on 2 Jun 2017  ·  8Comments  ·  Source: eggjs/egg

Node Version**:8.0.0
 Egg Version**:1.4.0
"autod-egg": "^1.0.0",
"egg-bin": "^3.4.0",
"egg-ci": "^1.6.0",
"egg-mock": "^3.7.0",
 chrome: 58.0.3029.110 (64-bit)
 Platform**:mac
 Mini Showcase Repository**:

cli初始化项目
运行 egg-bin debug
在devtools=>sources=>file=>只能看到node_modules内容

Most helpful comment

试了下,会输出几个地址,你访问的第一个是 master 的,自然没有。
访问第二个即可。

image

手动构造 URL 就可以,在 chrome://inspect 里面只显示 master 了。

chrome-devtools://devtools/bundled/inspector.html?experiments=true&v8only=true&ws=127.0.0.1:9231/53bdffdd-ab48-44d8-990e-4d4f4b0064fc

换掉 ws= 后面那段

All 8 comments

貌似是 node 8 的问题.

试了下,会输出几个地址,你访问的第一个是 master 的,自然没有。
访问第二个即可。

image

手动构造 URL 就可以,在 chrome://inspect 里面只显示 master 了。

chrome-devtools://devtools/bundled/inspector.html?experiments=true&v8only=true&ws=127.0.0.1:9231/53bdffdd-ab48-44d8-990e-4d4f4b0064fc

换掉 ws= 后面那段

是node8的问题,node8用devtools和webstorm的npm debug都不行,换成lts版本就都能正常debug了

@akliyiping 我试过 node8 了,按我上面说的就可以了。

@atian25 3q

根据 https://github.com/nodejs/node/issues/13387#issuecomment-306851784 的描述,可以自己 configure 下,访问 chrome://inspect 配置下端口,就能访问了,有 app_worker 那个就是我们的 app。

我发个 PR,补充到文档。

image

cc @m31271n

文档已经补充到 https://eggjs.org/zh-cn/core/development.html#使用-egg-bin-调试

@akliyiping 这里有个 PR,是个在 chrome devtools 中调试比较理想的方案,可以关注下~
https://github.com/eggjs/egg-development-proxyworker/pull/5

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bupafengyu picture bupafengyu  ·  3Comments

dizhifeng picture dizhifeng  ·  3Comments

ycvcb123 picture ycvcb123  ·  3Comments

skyyangpeng picture skyyangpeng  ·  3Comments

whlsxl picture whlsxl  ·  3Comments