遵循Heroku的
Getting Started教程比我预期的更令人沮丧.我现在所拥有的可能是一个配置问题,它可以在不到10次点击的情况下解决,但我不知道这些点击是什么,它正在推动我的问题.
工头不会开始.我没有Ruby,Heroku或Foreman的经验,也没有任何网络编程经验,所以我完全不知道这里发生了什么.这是我得到的错误消息,运行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)
谷歌正在躲避我.任何搜索都无法找到答案.我重新启动,重新安装,重写,重新复制,重读等等,我找不到解决方案.我的代码完全反映了上面链接的“入门”页面上的代码,为方便起见,我将在此处粘贴:
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 >Foreman Start – Error: write EINVAL
Node.js Expres.js Heroku Toolbelt >Foreman Start – Error: write EINVAL
我和Jek有同样的问题.我使用快递4.4.4.我降级快递3.2.6并且它有效,但我不应该被迫使用较旧版本的快递,因为工头不支持它.
我尝试了node-foreman.它对我有用.我按照包含这些步骤的说明进行操作:
> npm install -g foreman
> nf开始
我想知道是否有人有其他建议.