nodejs中调试包的nodemon问题

nodemon issue with debug package in nodejs

我正在尝试使用 debug package through nodemon package 调试我的应用程序,但我遇到了很多麻烦,因为我需要的输出隐藏在混乱的无关信息中,如您所见

错误/问题

[nodemon] restarting due to changes...
  nodemon bus emit: restart +25s
  nodemon bus new listener: start (0) +0ms
  nodemon bus new listener: start (0) +1ms
[nodemon] starting `node ./build/index.js`
  nodemon fork C:\Windows\system32\cmd.exe /d /s /c node ./build/index.js +25s
  nodemon bus emit: start +5ms
  nodemon bus new listener: exit (2) +1ms
  nodemon start watch on: *.* +2ms
[nodemon] restarting due to changes...
  nodemon bus emit: restart +4ms
  nodemon bus.emit(exit) via SIGUSR2 +218ms
  nodemon bus emit: exit +215ms
[nodemon] starting `node ./build/index.js`
  nodemon fork C:\Windows\system32\cmd.exe /d /s /c node ./build/index.js +5ms
  nodemon bus emit: start +5ms
  nodemon bus new listener: exit (1) +1ms
  nodemon start watch on: *.* +2ms
  app:normal it is normal debugger... +0ms
Listening on port: 3000
^CTerminate batch job (Y/N)? y

E:\Web Apps\RESTful API\express-demo>nodemon ./build/index.js
  nodemon bus new listener: reset (0) +0ms
  nodemon bus new listener: reset (0) +3ms
  nodemon bus new listener: quit (0) +26ms
  nodemon bus new listener: quit (0) +0ms
  nodemon bus new listener: restart (0) +1ms
  nodemon bus new listener: restart (0) +0ms
  nodemon bus new listener: reset (2) +6ms
  nodemon bus emit: reset +1ms
  nodemon resetting watchers +0ms
  nodemon reset +0ms
  nodemon config: dirs [ 'E:\Web Apps\RESTful API\express-demo' ] +0ms
[nodemon] 1.17.3
[nodemon] to restart at any time, enter `rs`
  nodemon bus new listener: error (0) +106ms
  nodemon bus new listener: error (0) +0ms
[nodemon] watching: *.*
[nodemon] starting `node ./build/index.js`
  nodemon fork C:\Windows\system32\cmd.exe /d /s /c node ./build/index.js +0ms
  nodemon bus new listener: exit (0) +12ms
  nodemon bus new listener: exit (0) +1ms
  nodemon start watch on: *.* +3ms
  nodemon start watch on: E:\Web Apps\RESTful API\express-demo +119ms
  nodemon ignored [ '**/.git/**',
  '**/.nyc_output/**',
  '**/.sass-cache/**',
  '**/bower_components/**',
  '**/coverage/**',
  '**/node_modules/**',
  re: /.*.*\/\.git\/.*.*|.*.*\/\.nyc_output\/.*.*|.*.*\/\.sass\-cache\/.*.*|.*.*\/bower_components\/.*.*|.*.*\/coverage\/.*.*|.*.*\/node_modules\/.*.*/ ] +1ms
  nodemon watch is complete +147ms
  app:normal it is normal debugger... +0ms
Listening on port: 3000

我正在按照这些命令来调试我的应用程序

里面index.js

const debug = require('debug')('app:start')
debug('debugging the app... Yup!')

航站楼内

set DEBUG=app:start // inside terminal
nodemon index.js // inside terminal

问题很愚蠢,我 运行在导致问题的不同终端中执行这两个命令

set DEBUG=app:start // inside terminal
nodemon index.js // inside terminal

确保 运行 这些命令在同一个终端中。 希望这会为某人节省时间。