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

roadhog server报错events.js:163问题排查过程,致浮躁的自己 #6

Open
xiaosongxiaosong opened this issue Apr 25, 2017 · 1 comment

Comments

@xiaosongxiaosong
Copy link
Owner

xiaosongxiaosong commented Apr 25, 2017

那些没有消灭你的东西,会使你变得更强壮。
That which does not kill us makes us stronger.
——尼采

最近在接触reactjs,各种概念蜂拥而来,在写demo时碰到问题没有细致的了解原因,连续换了几次实现合start kit,偶然的情况下定位出了一个问题原因,回想这几天太浮躁了,记录一下过程警示浮躁的自己

问题现象

roadhog server启动的时候报错

$ yarn start
yarn start v0.22.0
$ roadhog server
events.js:163
      throw er; // Unhandled 'error' event
      ^

Error: listen EACCES 127.0.0.1:8000
    at Object.exports._errnoException (util.js:1029:11)
    at exports._exceptionWithHostPort (util.js:1052:20)
    at Server._listen2 (net.js:1251:19)
    at listen (net.js:1300:10)
    at doListening (net.js:1399:7)
    at GetAddrInfoReqWrap.asyncCallback [as callback] (dns.js:62:16)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:78:10)
Done in 2.28s.

问题排查过程

1. 酷狗音乐默认开机启动的
2. 使用 yarn start 启动 roadhog 报错
$ yarn start
yarn start v0.22.0
$ roadhog server
events.js:163
      throw er; // Unhandled 'error' event
      ^

Error: listen EACCES 127.0.0.1:8000
    at Object.exports._errnoException (util.js:1029:11)
    at exports._exceptionWithHostPort (util.js:1052:20)
    at Server._listen2 (net.js:1251:19)
    at listen (net.js:1300:10)
    at doListening (net.js:1399:7)
    at GetAddrInfoReqWrap.asyncCallback [as callback] (dns.js:62:16)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:78:10)
Done in 2.28s.
3. 由于昨天是可以正常启动的,使用google搜索 roadhog events.js:163 throw er; 发现此issue,猜测会不会是同一问题,使用windows命名进行排查
C:\Users\XXX>netstat -ano|findstr 8000
  TCP    0.0.0.0:8000           0.0.0.0:0              LISTENING       2952
  UDP    0.0.0.0:8000           *:*                                    2952

8000端口果然被占用,参看进程名称

C:\Users\XXX>tasklist|findstr  2952
KGService.exe                 2952 Console                    2     17,356 K

百度一下进程名称发现是酷狗的进程
https://zhidao.baidu.com/question/477865310.html

4. 关闭酷狗后roadhog 正常启动
C:\Users\XXX>tasklist|findstr  KGService.exe

C:\Users\XXX>
$ yarn start
yarn start v0.22.0
$ roadhog server
Starting the development server...

[babel-plugin-dva-hmr][INFO] got routerPath ./router
Compiled successfully!

The app is running at:

  http://localhost:8000/

Note that the development build is not optimized.
To create a production build, use npm run build.

问题回顾

最开始的时候是在使用antd-admin 的时候已经出现了,切换了几次分支都无法启动,心态不太好,没有去查问题的原因反而怀疑是这个项目的问题就放弃了,之后使用Ant Design of React官网提供的项目实战从头开始,当时有可能关闭了进程roadhog可以正常启动,第二天过来再启动的时候又报错了才去细致的了解问题原因。
回想一下这段时间的自己,碰到问题总是想办法回避,然后又碰到下一个问题,总是想着快一点开始反而一直在原地踏步,对于nodejs报错内心深处的恐惧在这个问题面前暴露无遗。

@xiaosongxiaosong
Copy link
Owner Author

使用vscode启动roadhog自动更新重新vscode出现roadhog任务未退出,重新启动roadhog失败,使用windows tskill可以将残留的任务删除

Microsoft Windows [版本 10.0.15063]
(c) 2017 Microsoft Corporation。保留所有权利。

C:\Users\Don Quixote>netstat -ano|findstr 8000
  TCP    127.0.0.1:8000         0.0.0.0:0              LISTENING       14156
  UDP    0.0.0.0:8000           *:*                                    220

C:\Users\XXX>tskill 14156

C:\Users\XXX>netstat -ano|findstr 8000
  UDP    0.0.0.0:8000           *:*                                    220

C:\Users\XXX>

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

1 participant