来自Heroku Toolbelt的工头,出现错误:每次都写EINVAL

继Heroku的入门教程之后,我的预期就更令人沮丧了。 我现在所拥有的可能是一个configuration问题,它可能只需要不到10次点击就可以解决,但是我不知道这些点击是什么,这使我很快就陷入困境。

工头不会启动。 我没有使用Ruby,Heroku或Foreman的经验,也没有使用networking编程的经验,所以我完全不知道这里发生了什么。 这是我得到的错误信息,运行Windows 7 64位:

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正在逃避我。 我找不到任何search的答案。 我重新启动,重新安装,重写,重新复制,重新读取等,我找不到解决scheme。 我的代码完全反映了上面链接的入门页面上的代码,为便于说明,我将在这里粘贴:

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" } } 

再一次,我完全按照“入门”页面上的说明进行操作,但是工头拒绝启动。 这里发生了什么?

这里有一个类似的Stackoverflow Q / A:
Node.js Expres.js Heroku Toolbelt>工头开始 – 错误:写入EINVAL

我和Jek有同样的问题。 我正在使用快递4.4.4。 我降级expression3.2.6和它的工作,但我不应该被迫使用旧版本的快递,因为工头不支持它。

我试过节点领class 。 它为我工作。 我遵循了包含以下步骤的说明:

  1. npm install -g工头
  2. 如果开始

我想知道是否有人有额外的build议。

这不是一个很好的解决scheme,但我已经想出了如何使工头工作。 “入门”页面上的说明必须打破或过时。 以下是我如何得到工头的工作:

  1. 保持package.json一致。
  2. 删除web.js
  3. 通过在命令行运行express my_app_name创build标准的Express应用程序。
  4. 创build一个导入Express的app.js并启动服务器的index.js文件。
  5. configurationProcfile指向index.js
  6. 运行foreman start ,它应该工作。

我不知道这是为什么,以前的步骤没有。 祝你好运,未来的search者,在你的追求。