Node.js:Foreman+;Windows上的Nodemon行为
经过数小时的调试,我终于找出了我的web应用程序在Windows上崩溃的原因。NPM依赖项有时使用控制台记录消息。错误,在OSX和Windows上运行Foreman+Nodemon组合时,这似乎有不同的行为 也许对这些工具有更多了解的人可以帮助我们了解一下这一点? 下面是一个简单的应用程序来说明这一点: app.jsNode.js:Foreman+;Windows上的Nodemon行为,windows,node.js,foreman,Windows,Node.js,Foreman,经过数小时的调试,我终于找出了我的web应用程序在Windows上崩溃的原因。NPM依赖项有时使用控制台记录消息。错误,在OSX和Windows上运行Foreman+Nodemon组合时,这似乎有不同的行为 也许对这些工具有更多了解的人可以帮助我们了解一下这一点? 下面是一个简单的应用程序来说明这一点: app.js console.log('1'); console.error('2'); console.log('3'); 运行nodemon--exec node app.js可以在OSX
console.log('1');
console.error('2');
console.log('3');
运行nodemon--exec node app.js
可以在OSX和Windows 7上正常工作,并提供预期的输出:
18 Feb 23:56:25 - [nodemon] v0.6.23
18 Feb 23:56:26 - [nodemon] watching: C:\project
18 Feb 23:56:26 - [nodemon] starting `node app.js`
1
2
3
18 Feb 23:56:26 - [nodemon] clean exit - waiting for changes before restart
现在,使用Foreman和Procfile包装调用,如下所示:
# Procfile
app: nodemon --exec node app.js
在OSX上:
> foreman start
23:59:12 app.1 | started with pid 69229
23:59:12 app.1 | 18 Feb 23:59:12 - [nodemon] v0.7.2
23:59:12 app.1 | 18 Feb 23:59:12 - [nodemon] watching: /project
23:59:12 app.1 | 18 Feb 23:59:12 - [nodemon] starting `node app.js`
23:59:12 app.1 | 1
23:59:12 app.1 | 2
23:59:12 app.1 | 3
23:59:12 app.1 | 18 Feb 23:59:12 - [nodemon] clean exit - waiting for changes before restart
在Windows上:
> foreman start
23:59:40 app.1 | started with pid 2624
23:59:40 app.1 | 18 Feb 23:59:40 - [nodemon] v0.7.2
23:59:40 app.1 | 18 Feb 23:59:40 - [nodemon] watching: C:\project
23:59:40 app.1 | 18 Feb 23:59:40 - [nodemon] starting `node app.js`
23:59:40 app.1 | 1
23:59:40 app.1 | 18 Feb 23:59:40 - [nodemon] exception in nodemon killing node
23:59:40 app.1 | exited with code 3
23:59:40 system | sending SIGKILL to all processes
应用程序只是崩溃,没有恢复,然后Foreman终止Procfile中声明的任何其他进程
任何想法都将不胜感激
注意:我在Windows(6.2.3)上尝试了不同版本的
nodemon
,结果相同我也有同样的问题。我也试着重新运行,但没有成功。