简体   繁体   English

将主人推到heroku的问题

[英]Problem pushing a master to heroku

I'm follow an online railstutorial 我正在关注在线铁路教程

Everything is ok but when trying to push the master directory to heroku. 一切都很好但是在尝试将主目录推送到heroku时。 When it come to this: 当它出现时:

Installing rails3_serve_static_assets... done
-----> Gemfile detected, running Bundler version 1.0.0

install everything but sqlite3, here it output:
Installing sqlite3 (0.1.1) /usr/ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/installer.rb:164:in `install': sqlite3 requires Ruby version >= 1.9.1. (Gem::InstallError)
from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/source.rb:100:in `install'
        from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/installer.rb:55:in `run'
        from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/spec_set.rb:12:in `each'
        from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/spec_set.rb:12:in `each'
        from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/installer.rb:44:in `run'
        from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/installer.rb:8:in `install'
        from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/cli.rb:217:in `install'
        from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/vendor/thor/task.rb:22:in `send'
        from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/vendor/thor/task.rb:22:in `run'
        from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
        from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/vendor/thor.rb:246:in `dispatch'
        from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/vendor/thor/base.rb:389:in `start'
        from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.0/bin/bundle:13
        from /usr/ruby1.8.7/bin/bundle:19:in `load'
        from /usr/ruby1.8.7/bin/bundle:19
       FAILED:
 !     Heroku push rejected, failed to install gems via Bundler

Now the thing is: I am using ruby 1.9.2, 1.8.7 is not even installed. 现在的问题是:我使用的是ruby 1.9.2,甚至没有安装1.8.7。 when I list my local gems, bundle has this two versions: bundler (1.0.2, 1.0.1) (I don't know why) So it seems that there is something bad with the paths but I don't know how to solve it. 当我列出我的本地宝石时,bundle有这两个版本:bundler(1.0.2,1.0.1)(我不知道为什么)所以似乎路径有些不好但我不知道如何解决这个问题。 Thanks for your help. 谢谢你的帮助。

You're going off on the wrong path - Heroku doesn't run Sqlite, it runs PostgreSQL . 你走错了路 - Heroku不运行Sqlite,它运行PostgreSQL When you deploy your app it creates a new database.yml file for you. 部署应用程序时,它会为您创建一个新的database.yml文件。 So you shouldn't specify Sqlite in your gemfile - you should only specify it for your development environment. 所以你不应该在你的gemfile中指定Sqlite - 你应该只为你的开发环境指定它。

Something like this: 像这样的东西:

group :production, :staging do
  gem "pg"
end

group :development, :test do
  gem "sqlite3-ruby", :require => "sqlite3"
end

If you want to read more about Heroku database stuff, go here . 如果您想了解更多关于Heroku数据库的信息,请访问此处 I asked a similar question (and got my answer) here . 在这里问了一个类似的问题(并得到了答案)。

你想使用sqlite3-ruby gem,而不是sqlite3 gem。

Make sure you install pg. 确保安装pg。 At least that is what I did wrong. 至少那是我做错了。 Here you will find some help doing that. 在这里你会发现一些帮助。 The groupthingy also look like sound advice groupthingy看起来也像是一个好听的建议

Ruby 1.9 isn't yet supported on heroku. heroku 尚不支持 Ruby 1.9。 Try to live with 1.8.7 (for example, downgrade a little your sqlite3 gem). 尝试使用1.8.7(例如,降级你的sqlite3宝石)。

Do you really mean to install sqlite on Heroku? 你真的想在Heroku上安装sqlite吗? Shouldn't that gem be limited to your development environment only, not production? 宝石不应仅限于您的开发环境,而不是生产? You can't do much with sqlite on Heroku seeing how you can't write to the filesystem, nor can you specify a custom database (Heroku fully manages your database setting on pushed apps). 你不能对Heroku上的sqlite做很多事情,看你怎么不能写入文件系统,也不能指定自定义数据库(Heroku完全管理推送应用程序的数据库设置)。

The reason 1.8.7 is showing up in your log is that is the default ruby version on heroku. 1.8.7显示在您的日志中的原因是这是heroku上的默认ruby版本。 If you want to use 1.9.2, see the doc on switching stacks: http://docs.heroku.com/stack 如果要使用1.9.2,请参阅有关切换堆栈的文档: http//docs.heroku.com/stack

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

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