推送到heroku时,Ruby 2.0/Rails 4.0.0beta升级失败

Ben*_*ker 9 ruby ruby-on-rails heroku ruby-2.0 ruby-on-rails-4

大脑倾倒,因为我的谷歌用谷歌搜索并在电脑上猛击我的头.任何帮助或线索将非常感谢!

我通过rvm管理我的宝石.

$ ruby -v
ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-darwin12.2.0]

$ rails -v
Rails 4.0.0.beta1
Run Code Online (Sandbox Code Playgroud)

然后,当我想从头开始创建一个全新的应用程序

$ rails new brand_new_app
 create  
  create  README.rdoc
  ...
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.

$ cd brand_new_app
Run Code Online (Sandbox Code Playgroud)

然后我初始化一个git repo,添加我刚创建的应用程序.然后我创建一个heroku实例

brand_new_app $ heroku create
    Git remote heroku added
Run Code Online (Sandbox Code Playgroud)

然后我尝试部署到heroku但它在活动支持gem上失败.

brand_new_app $ git push heroku master
    Counting objects: 62, done.
    Delta compression using up to 4 threads.
    Compressing objects: 100% (50/50), done.
    Writing objects: 100% (62/62), 20.54 KiB, done.
    Total 62 (delta 2), reused 0 (delta 0)

    -----> Ruby/Rails app detected
    -----> Installing dependencies using Bundler version 1.3.2
   Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin --deployment
   Fetching gem metadata from https://rubygems.org/.........
   Fetching gem metadata from https://rubygems.org/..
   Installing rake (10.0.3)
   Installing i18n (0.6.4)
   Installing minitest (4.6.2)
   Installing multi_json (1.6.1)
   Installing atomic (1.0.1)
   Installing thread_safe (0.1.0)
   Installing tzinfo (0.3.37)
   Installing activesupport (4.0.0.beta1)
   Gem::InstallError: activesupport requires Ruby version >= 1.9.3.
   An error occurred while installing activesupport (4.0.0.beta1), and Bundler
   cannot continue.
   Make sure that `gem install activesupport -v '4.0.0.beta1'` succeeds before
   bundling.
     !
     !     Failed to install gems via Bundler.
     !
     !     Heroku push rejected, failed to compile Ruby/rails app
Run Code Online (Sandbox Code Playgroud)

我已经破坏了rvm(idk为什么,主要是因为我很沮丧)而且我已经检查过每一个可能的地方.我创建了rails应用程序,没有任何特殊设置,它只是一个正常的安装.如果有人有任何可以引导我走向正确方向的提示,请按我的方式发送给他们!我很感激你读到这里!

Arj*_*jan 18

您应该在Gemfile中放置一个ruby行,就像heroku文档中所解释的那样.

只需在Gemfile中添加ruby "2.0.0"下面的行source "https://rubygems.org".

https://blog.heroku.com/archives/2012/11/5/ruby-2-preview-on-heroku

我试过这个,这适用于heroku.显然Rails 4与不同的ruby版本不兼容.这有点奇怪,因为他们在这里说:

Ruby 2.0是与Rails 4.0一起使用的首选Ruby.

http://weblog.rubyonrails.org/2013/2/25/Rails-4-0-beta1/

显然是首选,意味着需要.

希望这可以帮助

  • 不要忘记你必须"git commit"你对heroku的更改才能确认它们.我花了很长时间才搞清楚.现在我会花很长时间感到愚蠢. (5认同)