首页 文章

资产预编译未找到宝石

提问于
浏览
2

我正在尝试使用capistrano 3.0来完全管理我的部署,从捆绑安装到预编译 . 但是,我一直遇到一个问题,“RAILS_ENV = 生产环境 佣金资产:预编译”似乎无法找到捆绑器安装的宝石 . 这是capistrano的输出:

DEBUG [8d404b6a] Finished in 1.289 seconds with exit status 0 (successful).
 INFO [9eb1acdc] Running ~/.rvm/bin/rvm ruby-2.0.0-p247 do bundle --gemfile /var/www/html/FingertipRails/releases/20131127152604/Gemfile --path /home/ec2-user/.rvm/gems/ruby-2.0.0-p247@global --deployment --binstubs /var/www/html/FingertipRails/shared/bin --without development test on 50.112.106.148
DEBUG [9eb1acdc] Command: cd /var/www/html/FingertipRails/releases/20131127152604 && ~/.rvm/bin/rvm ruby-2.0.0-p247 do bundle --gemfile /var/www/html/FingertipRails/releases/20131127152604/Gemfile --path /home/ec2-user/.rvm/gems/ruby-2.0.0-p247@global --deployment --binstubs /var/www/html/FingertipRails/shared/bin --without development test
DEBUG [9eb1acdc]    Your bundle is complete!
DEBUG [9eb1acdc]    Gems in the groups development and test were not installed.
DEBUG [9eb1acdc]    It was installed into /home/ec2-user/.rvm/gems/ruby-2.0.0-p247@global
 INFO [9eb1acdc] Finished in 2.892 seconds with exit status 0 (successful).
DEBUG [0de28eb8] Running if test ! -d /var/www/html/FingertipRails/releases/20131127152604; then echo "Directory does not exist '/var/www/html/FingertipRails/releases/20131127152604'" 1>&2; false; fi on 50.112.106.148
DEBUG [0de28eb8] Command: if test ! -d /var/www/html/FingertipRails/releases/20131127152604; then echo "Directory does not exist '/var/www/html/FingertipRails/releases/20131127152604'" 1>&2; false; fi
DEBUG [0de28eb8] Finished in 1.506 seconds with exit status 0 (successful).
 INFO [cb071501] Running ~/.rvm/bin/rvm ruby-2.0.0-p247 do rake assets:precompile on 50.112.106.148
DEBUG [cb071501] Command: cd /var/www/html/FingertipRails/releases/20131127152604 && ( RAILS_ENV=production ~/.rvm/bin/rvm ruby-2.0.0-p247 do rake assets:precompile )
DEBUG [cb071501]    /home/ec2-user/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/spec_set.rb:92:in `block in materialize'
DEBUG [cb071501]    : 
DEBUG [cb071501]    Could not find hashr-0.0.22 in any of the sources
DEBUG [cb071501]     (

这是我的staging.rb(我正在使用“cap staging deploy”):

set :stage, :staging
set :rails_env, "production"

set :user, "ec2-user"
role :app, %w{50.112.106.148}
role :web, %w{50.112.106.148}
role :db,  %w{50.112.106.148}

server '50.112.106.148', user: 'ec2-user', roles: %w{web app}

这是我的deploy.rb:

set :application, 'FingertipRails'
set :repo_url, 'git@github.com:dresources/FingertipRails.git'
set :branch, "master"

set :rvm_type, :user
set :bundle_cmd, "/home/ec2-user/.rvm/gems/ruby-2.0.0-p247@global/bin/bundle"
set :bundle_dir, "/home/ec2-user/.rvm/gems/ruby-2.0.0-p247@global"
set :bundle_flags, '--deployment'

有任何想法吗?

谢谢

编辑

以下是服务器上 rvm info 的输出:

ruby-2.0.0-p247:

  system:
    uname:       "Linux ip-10-226-137-104 3.4.62-53.42.amzn1.x86_64 #1 SMP Fri Sep 20 07:23:24 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux"
    system:      "amazon/2013.09/x86_64"
    bash:        "/bin/bash => GNU bash, version 4.1.2(1)-release (x86_64-redhat-linux-gnu)"
    zsh:         " => not installed"

  rvm:
    version:      "rvm 1.23.8 (master) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]"
    updated:      "1 month 10 days 44 minutes 13 seconds ago"
    path:         "/home/ec2-user/.rvm"

  ruby:
    interpreter:  "ruby"
    version:      "2.0.0p247"
    date:         "2013-06-27"
    platform:     "x86_64-linux"
    patchlevel:   "2013-06-27 revision 41674"
    full_version: "ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-linux]"

  homes:
    gem:          "/home/ec2-user/.rvm/gems/ruby-2.0.0-p247"
    ruby:         "/home/ec2-user/.rvm/rubies/ruby-2.0.0-p247"

  binaries:
    ruby:         "/home/ec2-user/.rvm/rubies/ruby-2.0.0-p247/bin/ruby"
    irb:          "/home/ec2-user/.rvm/rubies/ruby-2.0.0-p247/bin/irb"
    gem:          "/home/ec2-user/.rvm/rubies/ruby-2.0.0-p247/bin/gem"
    rake:         "/home/ec2-user/.rvm/gems/ruby-2.0.0-p247/bin/rake"

  environment:
    PATH:         "/home/ec2-user/.rvm/gems/ruby-2.0.0-p247/bin:/home/ec2-user/.rvm/gems/ruby-2.0.0-p247@global/bin:/home/ec2-user/.rvm/rubies/ruby-2.0.0-p247/bin:/home/ec2-user/.rvm/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/opt/aws/bin:/home/ec2-user/bin"
    GEM_HOME:     "/home/ec2-user/.rvm/gems/ruby-2.0.0-p247"
    GEM_PATH:     "/home/ec2-user/.rvm/gems/ruby-2.0.0-p247:/home/ec2-user/.rvm/gems/ruby-2.0.0-p247@global"
    MY_RUBY_HOME: "/home/ec2-user/.rvm/rubies/ruby-2.0.0-p247"
    IRBRC:        "/home/ec2-user/.rvm/rubies/ruby-2.0.0-p247/.irbrc"
    RUBYOPT:      ""
    gemset:       ""

1 回答

  • 1

    在Capistrano任务中,尝试添加您在配置中设置的 bundle_cmd 变量,以便 rake assets:precompilebundle exec 一起运行 . 如果没有看到deploy.rb中的其他变量,您将需要获取以下行:

    DEBUG [cb071501] Command: cd /var/www/html/FingertipRails/releases/20131127152604 && ( RAILS_ENV=production ~/.rvm/bin/rvm ruby-2.0.0-p247 do rake assets:precompile )
    

    ......看起来更像这样:

    cd /var/www/html/FingertipRails/releases/20131127152604 && ( RAILS_ENV=production ~/.rvm/bin/rvm ruby-2.0.0-p247 bundle exec rake assets:precompile )
    

相关问题