使用Webstormdebugging器和node.js

我几个星期前尝试使webstormdebugging器工作,但它没有。 我今天再试,但是我得到了同样的结果。

我遵循这些说明http://www.jetbrains.com/webstorm/webhelp/running-and-debugging-node-js.html#d93421e461

有我的configuration,我实际上有三个服务器(使用pomelo.js),一个用于web,一个作为web服务,托pipe在游戏服务器和游戏服务器,基本上无法直接从http请求到达。 (使用端口1500上的webservice来访问它)

https://docs.google.com/file/d/0ByzbHcAxmCyvQ1ZqZTFhREpZNGM https://docs.google.com/file/d/0ByzbHcAxmCyvV2JFWkwxTldJNFE https://docs.google.com/file/d/0ByzbHcAxmCyvZnVlYXNNSk4weHM https:// docs .google.com /文件/ d / 0ByzbHcAxmCyvN2o1VUhQR3cwX0U

当我点击运行:

"D:\Logiciels installés\nodejs\node.exe" --debug-brk=1337 web-server\app.js debugger listening on port 1337 

但是,如果我在网页上,我什么也得不到,只是这个错误:

 Code d'erreur : ERR_CONNECTION_ABORTED. 

现在,如果我以debugging模式运行它,两个debugging控制台打开: debuggingWeb:

 "D:\Logiciels installés\nodejs\node.exe" --debug-brk=29855 --debug-brk=1337 web-server\app.js debugger listening on port 1337 [ReferenceError: Buffer is not defined] Grunt watcher starting... *********** Controller Reader *********** GET/POST/PUT/DELETE => / GET/POST/PUT/DELETE => /chat GET/POST/PUT/DELETE => /demo GET/POST/PUT/DELETE => /login GET/POST/PUT/DELETE => /game GET/POST/PUT/DELETE => /subscribe POST => /game/connect GET => /mapEditor POST => /mapEditor/:action GET => /translate ********* Controller Reader End ********* Web server has started in development mode. Please log on http://127.0.0.1:1337/index.html grunt-cli: The grunt command line interface. (v0.1.11) 

但是,如果我去“debugging器”选项卡上,我得到了一个“无法连接”。

第二个debugging控制台“Debug Web slave#1”:我在控制台上没有任何东西,但是我在调​​试器选项卡上“连接到127.0.0.1:1337”。

有时当我尝试访问网页时,我在网页中看到类似这样的内容:

 Type: connect V8-Version: 3.14.5.9 Protocol-Version: 1 Embedding-Host: node v0.10.24 Content-Length: 0 

当我运行debugging模式,debuggingWebdebugging器选项卡尝试连接到一个30000左右的随机端口127.0.0.30xxx,但失败,然后显示“无法连接”。

有人明白发生了什么事吗? 因为我不…谢谢。

编辑

 Error: Failed to lookup view "..\views\game\layout.ejs" at Function.app.render (C:\wamp\www\Ayolan\web-server\node_modules\express\lib\application.js:493:17) at ServerResponse.res.render (C:\wamp\www\Ayolan\web-server\node_modules\express\lib\response.js:798:7) at C:\wamp\www\Ayolan\web-server\app\controllers\mainController.js:25:17 at Function.app.render (C:\wamp\www\Ayolan\web-server\node_modules\express\lib\application.js:495:14) at ServerResponse.res.render (C:\wamp\www\Ayolan\web-server\node_modules\express\lib\response.js:798:7) at module.exports.index (C:\wamp\www\Ayolan\web-server\app\controllers\mainController.js:13:13) at callbacks (C:\wamp\www\Ayolan\web-server\node_modules\express\lib\router\index.js:164:37) at param (C:\wamp\www\Ayolan\web-server\node_modules\express\lib\router\index.js:138:11) at pass (C:\wamp\www\Ayolan\web-server\node_modules\express\lib\router\index.js:145:5) at Router._dispatch (C:\wamp\www\Ayolan\web-server\node_modules\express\lib\router\index.js:173:5) 

 Error: Failed to lookup view "..\views\game\layout.ejs" at Function.app.render (C:\wamp\www\Ayolan\web-server\node_modules\express\lib\application.js:493:17) ... 

不太可能是由环境variables引起的,因为父环境variables默认传递给应用程序。 但是,我build议您确保通过点击https://docs.google.com/file/d/0ByzbHcAxmCyvQ1ZqZTFhREpZNGM/edit上的“环境variables”来传递父环境variables(应该勾选“包含父环境variables”) 。

更有可能“工作目录”被错误地指定。 确保它与从控制台启动应用程序时相同。

当我点击运行:

  D:\Logiciels installés\nodejs\node.exe" --debug-brk=1337 web-server\app.js debugger listening on port 1337 

但是,如果我在网页上,我什么也得不到,只是这个错误:

  Code d'erreur : ERR_CONNECTION_ABORTED. 

这是预料之中的,因为你的“debuggingWeb”运行confuguration有“–debug-brk = 1337”的参数,使Node.js应用程序启动后立即挂起。 要恢复它,一个Node.js远程debugging会话应该启动相同的端口。

现在,如果我以debugging模式运行它,两个debugging控制台打开:debuggingWeb:

  "D:\Logiciels installés\nodejs\node.exe" --debug-brk=29855 --debug-brk=1337 web-server\app.js debugger listening on port 1337 ... 

请注意,命令行包含两个重复的参数“–debug-brk = 29855”和“–debug-brk = 1337”。 第一个参数“–debug-brk = 29855”由WebStorm附加,第二个参数取自“Debug Web”运行configuration的“Node parameters”字段。

WebStorm假定应用程序将准备好在端口29855上进行debugging并等待连接。 但根据输出(“端口1337上的debugging程序”),应用程序的debugging器实际上是在端口1337上启动的。

接下来发生的事情是,WebStorm发现另一个debugging端口(1337)被打开,并假定它是一个子节点进程的debugging端口。 所以WebStorm启动“Node.js Remote Debug”运行与1337端口相关的configuration。 这就是为什么你看到第二个控制台(“debuggingWeb从站#1”)。

“debuggingWeb从站#1”控制台使用端口1337恢复应用程序执行。但“debuggingWeb”控制台正在等待来自端口29855的连接(这就是为什么你看到“无法连接”那里)。

只需在“节点参数”字段(“debuggingWeb”运行configuration)中删除“–debug-brk =”,它应该按预期工作。

希望这会有所帮助。