Following Heroku's Getting Started tutorial has been much more frustrating than I expected it to be. What I have right now is probably a config problem, and it can probably be solved in less than 10 clicks, but I don't know what those clicks are and it's driving me up the wall.
Foreman won't start. I have no experience with Ruby, or Heroku, or Foreman, and barely any experience with web programming, so I have absolutely no idea what's happening here. Here's the error message I get, running Windows 7 64 bit:
C:\Users\___________\hello_world_basics>foreman start
09:40:17 web.1 | started with pid 2408
09:40:18 web.1 | Listening on 5000
09:40:18 web.1 |
09:40:18 web.1 | Error: write EINVAL
09:40:18 web.1 | at errnoException (net.js:904:11)
09:40:18 web.1 | at Socket._write (net.js:645:26)
09:40:18 web.1 | at doWrite (_stream_writable.js:226:10)
09:40:18 web.1 | at writeOrBuffer (_stream_writable.js:216:5)
09:40:18 web.1 | at Socket.Writable.write (_stream_writable.js:183:11)
09:40:18 web.1 | at Socket.write (net.js:615:40)
09:40:18 web.1 | at Console.log (console.js:53:16)
09:40:18 web.1 | at Server.<anonymous> (C:\Users\___________\hello_world_basics\web.js:14:11)
09:40:18 web.1 | at Server.g (events.js:180:16)
09:40:18 web.1 | exited with code 8
09:40:18 system | sending SIGKILL to all processes
09:40:18 | at Server.EventEmitter.emit (events.js:92:17)
Google is evading me. I can't find the answer with any searching. I've restarted, reinstalled, rewritten, recopied, reread, etc. and I can't find a solution. My code exactly mirrors the code on the Getting Started page linked above, which I'll paste here for convenience:
Procfile:
web: node web.js
web.js
var express = require("express");
var logfmt = require("logfmt");
var app = express();
app.use(logfmt.requestLogger());
app.get('/', function(req, res) {
res.send('Hello World!');
});
var port = Number(process.env.PORT || 5000);
app.listen(port, function() {
console.log("Listening on " + port);
});
packge.json
{
"name": "hello_world_basics",
"version": "0.0.0",
"description": "A simple hello world app.",
"main": "web.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "[email protected]:hello_world_basics.git"
},
"keywords": [
"twitter",
"quality",
"bestof"
],
"author": "Lincoln Bergeson",
"license": "ISC",
"dependencies": {
"logfmt": "^1.1.2",
"express": "^4.4.3"
}
}
Again, I followed everything exactly as I should have on the Getting Started page, but foreman refuses to start. What's going on here?
Here's a similar Stackoverflow Q/A:
Node.js Expres.js Heroku Toolbelt >Foreman Start - Error: write EINVAL
I had the same issues as Jek. I was using express 4.4.4. I downgraded express 3.2.6 and it worked, but I shouldn't be forced to use an older version of express just because foreman doesn't support it.
I tried node-foreman. And it worked for me. I followed the instructions that included these steps:
I would like to know if anyone has additional suggestions.
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