使用下面的代碼從我發現的例子中,我的Heroku Node.js應用程序崩潰。當我瀏覽到[MYAPP] .herokuapp.com它沒有響應Node.js Heroku應用程序崩潰,錯誤R10(啓動超時)`heroku restart`不起作用
var http = require('http');
var port = process.env.PORT || 8000;
var counter = 0;
http.createServer(function (req, res) {
// increment the counter for each visitor request
counter=counter+1;
var path = req.url;
console.log("requested=" + path + " counter=" + counter);
res.writeHead(200, {'Content-Type': 'text/html'}); // prepare response headers
res.end(" :) ");
}).listen(port);
我procfile是
web: node thenameofmyapp.js
我已經做了heroku ps:scale web=1
我有一些依賴,但是除去他們嘗試獲取一個簡單的應用程序工作。我當前的package.json是
{
"name": "thenameofmyapp",
"version": "0.0.3",
"dependencies": {
},
"engines": {
"node": "0.10.x",
"npm": "1.2.x"
}
}
爲什麼我的應用程序無法綁定到端口?
編輯:它看起來即使經過多次更新和運行heroku restart
,我的應用程序仍在運行不再存在的代碼。這裏發生了什麼?