私はnode.jsアプリケーションをherokuにデプロイしようとしていますが、foremanを使用してローカルで起動しようとするとエラーが発生します:EADDRINUSE。私はnetstatを実行し、他の何もそれを使用しているポートのために挨拶し、ノードhttpサーバーとして直接実行しているときに問題なくサーバーが起動します。Heroku ForemanでNode.jsアプリを起動するときに使用するポート
私が配備しようとしているアプリは、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
ありがとうございます。 ウェブ:ノードが
をweb.jsし、次のように私はリスナーを設定している:
var port = process.env.PORT || 5000;
app.listen(port, function() {
console.log("Listening on " + port);
});
特定のポートでHTTPサーバーを起動しようとしていますか? ([tag:heroku]でHTTPサーバを起動するときはいつでもポート番号として 'process.env.PORT'を使うべきです) – fardjad
Procfileとnode.ks appの設定を投稿してください – Winfield
リクエストされた追加の詳細を見つけてください上記の元の投稿の上に – Craig