I've written a basic node.js application and I've managed to deploy it on Heroku without having any problem. I've created my package.json and Procfile, however from logs I see that there is no running processes, thus cannot get any response. What could be the problem?
PS: I do not want to use the Express framework
My Code:
var http = require("http");
http.createServer(function(request, response) {
response.writeHead(200, {"Content-Type": "text/plain"});
response.write("Hello World");
response.end();
console.log("I am working");
}).listen(8888);
My package.json:
{
"name": "node-example",
"version": "0.0.1",
"dependencies": {
},
"engines": {
"node": "0.8.x",
"npm": "1.1.x"
}
}
Logs:
2012-10-22T12:36:58+00:00 heroku[slugc]: Slug compilation started
2012-10-22T12:37:07+00:00 heroku[slugc]: Slug compilation finished
2012-10-22T12:40:55+00:00 heroku[router]: Error H14 (No web processes running) -> GET aqueous-bastion-6914.herokuapp.com/ dyno= queue= wait= service= status=503 bytes=
2012-10-22T12:50:44+00:00 heroku[router]: Error H14 (No web processes running) -> GET aqueous-bastion-6914.herokuapp.com/ dyno= queue= wait= service= status=503 bytes=
There are some errors which only occur when the app is rebooting so you will need to restart the app to see these log messages appear. For most apps, we also recommend enabling one of the free logging addons from https://elements.heroku.com/addons#logging to make sure that your historical log data is being saved.
Sometimes installing a dependency or running a build locally completes successfully, and when it gets to Heroku, the build will fail. If you run into an issue where a dependency only fails on Heroku, it's recommended to spin up a one-off dyno to debug the script.
Heroku by default installs only the production dependencies, ignoring the development dependencies under devDependencies .
Have you scaled the heroku app?
$ heroku ps:scale web=1
This is a required step. The 1
is the number of processes you want spawned for your app.
Change your port
from
.listen(8888)
to
.listen(process.env.PORT || 8888)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With