如果使用的是 Linux 或 Mac,可以使用 sudo npm install -g supervisor来安装。
接下来,使用 supervisor动 app.js: $ supervisor app.js
DEBUG: Running node-supervisor with
DEBUG: program ‘app.js'
DEBUG: –watch ‘.'
DEBUG: –extensions ‘node|js'
DEBUG: –exec ‘node'
DEBUG: Starting child process with ‘node app.js' DEBUG: Watching directory ‘/home/byvoid/.' for changes. HTTP server is listening at port 3000. 代码被改动时,运行本会被重新启动。在终端中显示的结果如下:
DEBUG: crashing child
DEBUG: Starting child process with ‘node app.js'
HTTP server is listening at port 3000.
如果使用的是 Linux 或 Mac,可以使用 sudo npm install -g supervisor来安装。
接下来,使用 supervisor动 app.js: $ supervisor app.js
DEBUG: Running node-supervisor with
DEBUG: program ‘app.js'
DEBUG: –watch ‘.'
DEBUG: –extensions ‘node|js'
DEBUG: –exec ‘node'
DEBUG: Starting child process with ‘node app.js' DEBUG: Watching directory ‘/home/byvoid/.' for changes. HTTP server is listening at port 3000. 代码被改动时,运行本会被重新启动。在终端中显示的结果如下:
DEBUG: crashing child
DEBUG: Starting child process with ‘node app.js'
HTTP server is listening at port 3000.