在Heroku教程中无法使用Python启动foreman
我一直在尝试完成这个教程,但是在执行foreman start
这一行时遇到了问题。我使用的是一台64位的Windows 7电脑,并且是在Heroku工具包提供的git bash终端中进行操作。
当我输入foreman start
时,出现了以下内容:
sh.exe": /c/Program Files (x86)/Heroku/ruby-1.9.2/bin/foreman: "c:/Program: bad
interpreter: No such file or directory
于是我尝试在git bash中输入命令cmd
,然后再使用foreman start
(这和某个回答中的评论建议的做法类似)。结果是这样的:
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
对于第二组错误信息我完全不明白它在说什么,因为它似乎提到的engine.rb文件的路径在我的电脑上根本不存在。
我查看了其他类似问题的回答,但我遇到的错误和那些不一样,所以我觉得目前没有解决我问题的方法。
4 个回答
6
卸载 Heroku 工具包,然后重新安装到一个路径中,确保这个路径里没有空格,比如 C:\heroku\
,这样会有一点帮助。此外,目前 Heroku 的 Windows 安装程序非常不稳定,这并不是我们引以为傲的地方。为了绕过 Foreman 的问题,你可以自己设置环境变量,方法是使用 export VAR=VALUE
,然后用你在 procfile 中写的命令来运行你的应用。
未来这个问题会得到改善。
11
是的,heroku-toolbelt-installer现在有点问题(2013年8月30日)。对于Windows用户,以下步骤对我有效:
- 通过Windows的“程序卸载”来卸载heroku。
- 从这个链接 https://toolbelt.heroku.com/windows 下载并安装heroku,安装到C:\bin\heroku,也就是说路径中不要有空格。
- 从这个网站 http://rubyinstaller.org/downloads/ 下载并安装ruby。
- 在命令提示符中运行“gem install foreman -v 0.61”。是的,直接运行“gem install foreman”会安装到0.63版本,但这个版本在运行“foreman start”时不管用。
- 在命令提示符中运行“foreman start”,可以成功运行heroku的hello-world示例。
70
我遇到了这个问题。我通过卸载foreman这个工具的0.62版本,然后安装0.61版本来解决的。
gem uninstall foreman
gem install foreman -v 0.61