Cra*_*aig 6 heroku node.js foreman
我正在尝试将我的node.js应用程序部署到heroku但是当我尝试使用foreman在本地启动时,我收到错误:听EADDRINUSE.我已经运行了一个netstat并且为端口进行了grepped,没有其他人正在使用它,并且当直接作为节点http服务器运行时,服务器启动时没有问题.
我试图部署的应用程序是使用mongo和redis我不确定这些组件是否会影响从Foreman开始的服务器.有没有人对我可以查看潜在错误的方面有任何建议?
foreman start
01:37:18 web.1  | started with pid 1835
01:37:18 web.1  | /usr/local/foreman/lib/foreman/process.rb:66: warning: Insecure world writable dir /usr/local in PATH, mode 040777
01:37:19 web.1  | events.js:72
01:37:19 web.1  |         throw er; // Unhandled 'error' event
01:37:19 web.1  |               ^
01:37:19 web.1  | Error: listen EADDRINUSE
01:37:19 web.1  |     at errnoException (net.js:863:11)
01:37:19 web.1  |     at Server._listen2 (net.js:1008:14)
01:37:19 web.1  |     at listen (net.js:1030:10)
01:37:19 web.1  |     at Server.listen (net.js:1096:5)
01:37:19 web.1  |     at Function.app.listen (/Users/craig/Documents/Sandboxes   /xxx/node_modules/express/lib/application.js:535:24)
01:37:19 web.1  |     at Object.<anonymous> (/Users/craig/Documents/Sandboxes/xxx/web.js:25:5)
01:37:19 web.1  |     at Module._compile (module.js:456:26)
01:37:19 web.1  |     at Object.Module._extensions..js (module.js:474:10)
01:37:19 web.1  |     at Module.load (module.js:356:32)
01:37:19 web.1  |     at Function.Module._load (module.js:312:12)
01:37:19 web.1  | exited with code 8
01:37:19 system | sending SIGTERM to all processes
SIGTERM received
谢谢.
- 附加信息 -
proc文件只有一个条目:web:node web.js
我已经将监听器设置如下:
var port = process.env.PORT || 5000;
app.listen(port, function() {
    console.log("Listening on " + port);
});
我刚刚在OS X上碰到了这个.看起来工头默认选择端口5000,这似乎与Bonjour/mDNS/UPNP服务冲突.(据我所读.我没有花时间去挑选它.)
但是,您可以通过两种方式更改foreman使用的端口:在命令行上指定端口或使用此处指定的端口号创建.foreman文件.
祝你好运,编码愉快!
| 归档时间: | 
 | 
| 查看次数: | 3410 次 | 
| 最近记录: |