代码之家  ›  专栏  ›  技术社区  ›  NullVoxPopuli

Ruby on Rails:Heroku:如何安装gems?

  •  1
  • NullVoxPopuli  · 技术社区  · 15 年前

    这是我的GemFile

    source :rubygems
    gem 'rails', '2.3.8'
    gem 'authlogic', '2.1.6'
    gem 'addresslogic', '1.2.1'
    gem 'searchlogic', '2.4.19'
    gem 'subdomain-fu', '0.5.4'
    

    但是,当我在heroku上运行这个应用程序时,我得到了“应用程序崩溃”

    日志上说我只安装了rails,我需要上面列出的非rails gems。

    我做错什么了?

    heroku push的输出

         % git push heroku master
    Counting objects: 10, done.
    Delta compression using up to 4 threads.
    Compressing objects: 100% (6/6), done.
    Writing objects: 100% (6/6), 860 bytes, done.
    Total 6 (delta 3), reused 0 (delta 0)
    
    -----> Heroku receiving push
    -----> Rails app detected
    -----> WARNING: Detected Rails is not declared in either .gems or Gemfile
           Scheduling the install of Rails 2.3.8.
           See http://docs.heroku.com/gems for details on specifying gems.
    
    -----> Installing gem rails 2.3.8 from http://rubygems.org
           Successfully installed activesupport-2.3.8
           Successfully installed activerecord-2.3.8
           Successfully installed rack-1.1.0
           Successfully installed actionpack-2.3.8
           Successfully installed actionmailer-2.3.8
           Successfully installed activeresource-2.3.8
           Successfully installed rails-2.3.8
           7 gems installed
    
           Compiled slug size is 11.7MB
    -----> Launching.... done
           http://%%%%%%%%%%%%%%%%%%%.heroku.com deployed to Heroku
    
    To git@heroku.%%%%%%%%%%%%%%%%%%%.git
       3ac597d..b849480  master -> master
    

    heroku原木

    ==> dyno-3334279.log <==
    Missing these required gems:
      authlogic  
      addresslogic  
      searchlogic  
    
    You're running:
      ruby 1.8.7.253 at /usr/ruby1.8.7/bin/ruby
      rubygems 1.3.7 at /home/slugs/362612_b849480_24ac-7763f7d7-8c04-478b-ab13-af81efd3e8c2/mnt/.bundle/gems/ruby/1.8, /home/slugs/362612_b849480_24ac-7763f7d7-8c04-478b-ab13-af81efd3e8c2/mnt/.bundle/gems, /home/slugs/362612_b849480_24ac-7763f7d7-8c04-478b-ab13-af81efd3e8c2/mnt/.gems, /usr/ruby1.8.7/lib/ruby/gems/1.8
    
    Run `rake gems:install` to install the missing gems.
    
    ==> production.log <==
    # Logfile created on Sun Nov 28 19:41:39 -0800 2010
    
    2 回复  |  直到 15 年前
        1
  •  3
  •   yfeldblum    15 年前

    如果您有一个名为 Gemfile (在这种情况下/拼写)在存储库的根目录中,Heroku将使用此文件来确定要安装的所有gem。

    你说过你有一个 GemFile -如果这是文件名在存储库中的大小写方式,Heroku可能不会接收它。

        2
  •  0
  •   DanneManne    15 年前

    您应该在应用程序根目录中创建一个名为.gems的文件。该文件应包含所需gem的列表,定义gem依赖项的语法如下:

    rails --version 2.3.8
    authlogic --version 2.1.6
    

    等。。。