Foreman, from Herobu Toolbelt, fails: write EINVAL every time

The following Heroku tutorial Getting started was much more unpleasant than I expected. The fact that I now have probably a configuration problem, and probably it can be solved in less than 10 clicks, but I donโ€™t know what these clicks are, and it makes me get on the wall.

Foreman will not start. I have no experience with Ruby, or Heroku, or Foreman, and practically no experience with web programming, so I donโ€™t know what is going on here. Here is 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 shying away from me. I can not find the answer in any search. I restarted, reinstalled, rewritten, rewritten, re-read, etc., and I cannot find a solution. My code accurately reflects the code on the Getting Started page above, which I will use 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": " git@heroku.com :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 on the Getting Started page, but the wizard refuses to start. What's going on here?

+6
source share
2 answers

This is not a good solution, but I figured out how to make the wizard work. The instructions on the Getting Started page must be broken or outdated. This is how I got the wizard job:

  • Keep package.json the same.
  • Delete web.js
  • Create a standard Express application by running express my_app_name on the command line.
  • Create an index.js file that imports Express app.js and starts the server.
  • Set up the Procfile to index.js .
  • Run foreman start and it should work.

I do not know why this works, and the previous steps did not. Good luck, future seekers, in your search.

0
source

Here's a similar Stackoverflow Q / A:
Node.js Expres.js Heroku Toolbelt> Foreman Start - Error: write EINVAL

I had the same problems as Jack. I used express 4.4.4. I downgraded express 3.2.6, and it worked, but I should not be forced to use an older version of the expression just because the wizard does not support it.

I tried node-foreman . And it worked for me. I followed the instructions that included the following steps:

  • npm install -g foreman
  • nf start

I would like to know if anyone has any further suggestions.

+8
source

Source: https://habr.com/ru/post/971063/


All Articles