简体   繁体   English

无法使用Python在Heroku教程中启动工头

[英]Can't start foreman in Heroku Tutorial using Python

I have been attempting to complete this tutorial , but have run into a problem with the foreman start line. 我一直试图完成本教程 ,但遇到了foreman start线的问题。 I am using a windows 7, 64 bit machine and am attempting to do this in the git bash terminal provided by the Heroku Toolbelt. 我正在使用Windows 7,64位机器,我试图在Heroku Toolbelt提供的git bash终端中执行此操作。

When I enter foreman start I receive: 当我进入foreman start我收到:

sh.exe": /c/Program Files (x86)/Heroku/ruby-1.9.2/bin/foreman: "c:/Program: bad
interpreter: No such file or directory

So I tried entering the cmd in git bash by typing cmd and then using foreman start (similar to a comment on one of the answers to this question suggests). 因此,我尝试通过键入cmd然后使用foreman start来输入git bash中的cmd (类似于对此问题的答案之一的评论 )。 This is what that produced: 这就是产生的:

Bad file descriptor
c:/Program Files (x86)/Heroku/ruby-1.9.2/lib/ruby/gems/1.9.1/gems/foreman-0.62.0
/lib/foreman/engine.rb:377:in `read_nonblock'
c:/Program Files (x86)/Heroku/ruby-1.9.2/lib/ruby/gems/1.9.1/gems/foreman-0.62.0
/lib/foreman/engine.rb:377:in `block (2 levels) in watch_for_output'
c:/Program Files (x86)/Heroku/ruby-1.9.2/lib/ruby/gems/1.9.1/gems/foreman-0.62.0
/lib/foreman/engine.rb:373:in `loop'
c:/Program Files (x86)/Heroku/ruby-1.9.2/lib/ruby/gems/1.9.1/gems/foreman-0.62.0
/lib/foreman/engine.rb:373:in `block in watch_for_output'
21:06:08 web.1  | exited with code 1
21:06:08 system | sending SIGKILL to all processes

I have no clue what the second set of errors is trying to tell me, since the file location it seems to claim engine.rb is running from does not even exist on my computer. 我不知道第二组错误试图告诉我什么,因为它似乎声称engine.rb运行的文件位置甚至不存在于我的计算机上。

I have looked at other answers to similar problems, however I am not receiving similar errors and so do not believe a solution to my problem currently exists. 我已经查看了类似问题的其他答案,但是我没有收到类似的错误,所以不相信我的问题的解决方案目前存在。

I had this problem. 我有这个问题。 I fixed it by uninstalling version 0.62 of the foreman gem and installing 0.61. 我通过卸载工头宝石的0.62版并安装0.61来修复它。

gem uninstall foreman
gem install foreman -v 0.61

Yes, heroku-toolbelt-installer is not working correctly at present (30-Aug-2013). 是的,heroku-toolbelt-installer目前无法正常工作(2013年8月30日)。 For windows the following steps worked for me: 对于Windows,以下步骤适用于我:

  1. uninstall heroku (via windows 'program uninstall') 卸载heroku(通过windows'程序卸载')
  2. install heroku https://toolbelt.heroku.com/windows into C:\\bin\\heroku , ie 'no spaces' 将heroku https://toolbelt.heroku.com/windows安装到C:\\ bin \\ heroku中,即'no spaces'
  3. install ruby from http://rubyinstaller.org/downloads/ http://rubyinstaller.org/downloads/安装ruby
  4. in cmd run "gem install foreman -v 0.61". 在cmd中运行“gem install foreman -v 0.61”。 Yes, "gem install foreman" installed v0.63, which does not work for "foreman start" 是的,“gem install foreman”安装了v0.63,这对“工头启动”不起作用
  5. in cmd "foreman start" works for the heroku hello-world example 在cmd“foreman start”适用于heroku hello-world示例

Uninstalling the heroku toolbelt and reinstall it to a path that does not have spaces in it, for example C:\\heorku\\ will help a bit. 卸载heroku工具带并将其重新安装到一个没有空格的路径中,例如C:\\heorku\\会有所帮助。 Aside from that the heroku windows installer is horribly broken at the moment, not exactly a point of pride for us. 除此之外,heroku windows安装程序目前可怕地被破坏,这对我们来说并不是一个值得骄傲的地方。 To work around the issue with foreman you can set the environment variables your self using export VAR=VALUE and then run your app using what ever commands you put in your procfile. 要解决foreman的问题,您可以使用export VAR=VALUE设置环境变量,然后使用您在procfile中输入的命令运行应用程序。

This is going to improve in the future. 这将在未来有所改善。

One thing to add is that if you install Heroku to a directory with spaces, that will also cause an error when you try and do gem install foreman -v 0.61 (on Windows). 要添加的一件事是,如果您将Heroku安装到带空格的目录中,那么当您尝试执行gem install foreman -v 0.61 (在Windows上)时也会导致错误。

Once I'd reinstalled Heroku to C:\\Heroku instead of C:\\Program Files\\Heroku then I was able to make this work using Eric Speelman's solution above. 一旦我将Heroku重新安装到C:\\ Heroku而不是C:\\ Program Files \\ Heroku,那么我就可以使用上面的Eric Speelman的解决方案来完成这项工作了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM