【问题标题】:How to debug application using nodemon in nodeJs如何在 nodeJs 中使用 nodemon 调试应用程序
【发布时间】:2016-07-15 17:29:30
【问题描述】:

我们可以使用语法在 nodeJs 中调试应用程序:node-debug app.js 但是如何使用 nodemon 进行调试 我试过nodemon --debug app.js 但它不起作用。 请帮助我如何使用 nodemon 进行调试 在此先感谢:)

【问题讨论】:

  • 您使用的是哪个 IDE?
  • Visual Studio 代码。我正在使用 Express 生成器,操作系统是 windows 8.1
  • @mauliksakhare 你找到修复了吗?或任何替代方案?
  • @PrameshBajracharya 我找不到任何方法。如果您找到任何方法,请告诉我
  • @mauliksakhare ,是的,我确实找到了解决方法。我是 nodemon 版本中的一个小错误。更多信息请查看stackoverflow.com/questions/47800466/…

标签: jquery node.js debugging express nodemon


【解决方案1】:

目前,“--debug”已被弃用,而是使用“--inspect”。

只需输入:$ nodemon --inspect app.js

你会看到这样的输出:

[nodemon] 2.0.4
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `node --inspect server.js`
Debugger listening on ws://127.0.0.1:9229/26849510-cfac-4aae-8dc0-8d9883809ba5
For help, see: https://nodejs.org/en/docs/inspector  
Debugger attached...  

要打开 GUI 调试器,请打开 Chrome 浏览器并在 URL 字段中输入:

[chrome://inspect#devices]

您会在打开的页面底部看到:

[  Remote Target
   #LOCALHOST
   Target (v12.18.3)  trace
   app.js
   file:///[your local path of the app.js    ]
   inspect

点击inspect你会看到调试器......享受它......

【讨论】:

    猜你喜欢
    • 2020-12-08
    • 2020-06-02
    • 2020-12-31
    • 1970-01-01
    • 1970-01-01
    • 2016-09-19
    • 2020-04-21
    • 1970-01-01
    • 2015-05-24
    相关资源
    最近更新 更多