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?
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?
Share Improve this question edited Jun 19, 2014 at 19:31 Lincoln Bergeson asked Jun 19, 2014 at 15:55 Lincoln BergesonLincoln Bergeson 3,4616 gold badges39 silver badges59 bronze badges2 Answers
Reset to default 8Here'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:
- npm install -g foreman
- nf start
I would like to know if anyone has additional suggestions.
This isn't a very good solution, but I have figured out how to make foreman work. The instructions on the Getting Started page must be broken or out of date. Here's how I got foreman to work:
- Keep package.json the same.
- Delete web.js
- Create a standard Express app by running
express my_app_name
at the mand line. - Create an
index.js
file that imports Express'sapp.js
and starts a server. - Configure the Procfile to point to
index.js
. - Run
foreman start
and it should work.
I don't know why this works and the previous steps did not. Good luck, future searchers, in your quest.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745087882a4610513.html
评论列表(0条)