Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

egg.js 在vscode中调试启动不了 #3960

Closed
MrSmallLiu opened this issue Sep 29, 2019 · 9 comments
Closed

egg.js 在vscode中调试启动不了 #3960

MrSmallLiu opened this issue Sep 29, 2019 · 9 comments

Comments

@MrSmallLiu
Copy link

egg版本为2.15.1 node版本为8.11.4.开发过程中使用vscode调试,启动过程中会卡住。
vscode配置如下:
image

@atian25
Copy link
Member

atian25 commented Sep 29, 2019

去掉 --inspect-brk 吧,如果你不理解它是什么含义的话

@atian25 atian25 closed this as completed Sep 29, 2019
@MrSmallLiu
Copy link
Author

MrSmallLiu commented Sep 29, 2019 via email

@MrSmallLiu
Copy link
Author

MrSmallLiu commented Sep 29, 2019 via email

@MrSmallLiu
Copy link
Author

MrSmallLiu commented Sep 29, 2019 via email

@atian25
Copy link
Member

atian25 commented Sep 29, 2019

可以看下 atian25/blog#25 正文的最后一段补充。

或者你可以直接不用这个,把 vscode 的 auto attach 配置打开就好了。
然后直接命令行 egg-bin debug 即可。

@MrSmallLiu
Copy link
Author

MrSmallLiu commented Sep 29, 2019 via email

@atian25
Copy link
Member

atian25 commented Sep 29, 2019

Egg 的调试,跟 Node 没啥区别,因此一定要了解 Node 的基础调试知识。
其中,--inspect-brk 是指在进程第一行就暂停,等待 attach,因此:

  1. master 先启动,在第一行会停住,需要你 attach master,才会往下走
  2. 接着 master 启动 agent,也是在第一行停住,需要 attach agent 才会往下走
  3. 最后 agent 启动完成后,worker 才开始启动,一样也是在第一行停住,需要 attach agent 才会往下走

从你的截图来看,就是运行到了我说的第二步,但 vscode 这时候没有自动 attach 导致的,估计是某些版本的 autoAttachChildProcesses: true 有 BUG。

@MrSmallLiu
Copy link
Author

MrSmallLiu commented Sep 29, 2019 via email

@atian25
Copy link
Member

atian25 commented Sep 29, 2019

你仔细看你截图里面的日志,master 和 agent 都启动了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants