Rom*_*ain 6 windows node.js foreman
经过几个小时的调试,我终于找到了为什么我的网络应用程序在Windows上崩溃的原因.NPM依赖有时会记录消息console.error,并且在运行Foreman + Nodemon组合时,这似乎在OSX和Windows上有不同的行为.
也许对这些工具有更多了解的人可以帮助解释一下这个问题?这是一个简单的应用程序来说明它:
app.js
console.log('1');
console.error('2');
console.log('3');
Run Code Online (Sandbox Code Playgroud)
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
Run Code Online (Sandbox Code Playgroud)
现在,使用Foreman和Procfile包装调用,它看起来像这样:
# Procfile
app: nodemon --exec node app.js
Run Code Online (Sandbox Code Playgroud)
在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
Run Code Online (Sandbox Code Playgroud)
在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
Run Code Online (Sandbox Code Playgroud)
该应用程序只是崩溃,没有恢复,然后Foreman杀死Procfile中声明的任何其他进程.
任何想法将不胜感激!
注意:我nodemon在Windows(6.2.3)上尝试了不同版本的相同结果
| 归档时间: |
|
| 查看次数: |
771 次 |
| 最近记录: |