簡體   English   中英

如何在 nodeJs 中使用 nodemon 調試應用程序

[英]How to debug application using nodemon in nodeJs

我們可以使用以下語法在 nodeJs 中調試應用程序: node-debug app.js但是如何使用 nodemon 進行調試我嘗試了nodemon --debug app.js但它不起作用。 請幫助我如何使用 nodemon 進行調試 提前致謝:)

當前,不推薦使用“--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 字段中輸入:

[鉻://檢查#設備]

您將在打開的頁面底部看到:

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

單擊以檢查您將看到調試器......享受它......

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM