2012-01-18 90 views
2

我尝试通过Capistrano运行我的应用程序。此外,我使用:Rails 3.1:无法找到耙

Ubuntu 10.04.1 LTS 
Phusion Passenger 
PostgreSQL 9 
Nginx 
Rails 3.1.3 
Ruby 1.9.3 

我做

cap deploy:update 

它创建的文件夹和后等

然后我尝试在/电流文件夹

rake RAILS_ENV=production db:schema:load 

而现在显示下一个:

Could not find rake-0.9.2.2 in any of the sources 
Run `bundle install` to install missing gems. 

但它的安装!我试过$ bundle install,$ gem update rake它没有帮助。此错误一次又一次出现。

$宝石列表

*** LOCAL GEMS *** 

actionmailer (3.1.3) 
actionpack (3.1.3) 
activemodel (3.1.3) 
activerecord (3.1.3) 
activeresource (3.1.3) 
activesupport (3.1.3) 
ansi (1.4.1) 
arel (2.2.1) 
autotest (4.4.6) 
builder (3.0.0) 
bundler (1.0.21 ruby) 
coffee-rails (3.1.1) 
coffee-script (2.2.0) 
coffee-script-source (1.2.0) 
daemon_controller (0.2.6) 
erubis (2.7.0) 
execjs (1.2.13) 
fastthread (1.0.7) 
ffi (1.0.11) 
gravatar_image_tag (1.0.0) 
hike (1.2.1) 
i18n (0.6.0) 
jquery-rails (1.0.19) 
json (1.6.5) 
libv8 (3.3.10.4 x86_64-linux) 
mail (2.3.0) 
mime-types (1.17.2) 
multi_json (1.0.4) 
passenger (3.0.11) 
pg (0.12.2) 
polyglot (0.3.3) 
rack (1.3.6) 
rack-cache (1.1) 
rack-mount (0.8.3) 
rack-ssl (1.3.2) 
rack-test (0.6.1) 
rails (3.1.3) 
railties (3.1.3) 
rake (0.9.2.2, 0.9.2) 
rdoc (3.12) 
sass (3.1.12) 
sass-rails (3.1.5) 
sprockets (2.0.3) 
sqlite3 (1.3.5) 
sys-uname (0.9.0) 
texticle (2.0) 
therubyracer (0.9.9) 
thor (0.14.6) 
tilt (1.3.3) 
treetop (1.4.10) 
turn (0.8.3) 
tzinfo (0.3.31) 
uglifier (1.2.2) 
will_paginate (3.0.2) 
ZenTest (4.6.2) 

$宝石列表耙

*** LOCAL GEMS *** 

rake (0.9.2.2, 0.9.2) 

这里是我的配置/ deploy.rb

set :user, "root"                

set :rails_env, "production" 

default_run_options[:pty] = true            
set :repository, "git://github.com/Loremaster/sample_app.git" 

set :application, "ror_tutorial" 
set :deploy_to, "/vol/www/apps/#{application}" 

set :scm, :git 
set :branch, "master" 

server "xxx.xxx.xxx.xxx", :app, 
          :web, 
          :db, :primary => true 



# If you are using Passenger mod_rails uncomment this: 
namespace :deploy do 
    task :start do ; end 
    task :stop do ; end 
    task :restart, :roles => :app, :except => { :no_release => true } do 
    run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}" 
    end 
end 

Capfile

load 'deploy' if respond_to?(:namespace) # cap2 differentiator 

# Uncomment if you are using Rails' asset pipeline 
# load 'deploy/assets' 

Dir['vendor/gems/*/recipes/*.rb','vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) } 

load 'config/deploy' # remove this line to skip loading any of the default tasks 

UPD:我在Gemfile中添加耙宝石,然后我的本地机器上运行bundle install,然后通过Capistrano的上传服务器上的固定佣金错误。

回答

0

我固定耙误差在Gemfile中添加gem rake,然后我的本地机器上运行bundle install,然后通过Capistrano的上传服务器上。

+0

我不认为这是做到这一点的正确方法,尽管它可能有效。我的答案是否在下面的工作,因为更好的方法是让capistrano用户成为唯一可以执行rails命令的用户。另外,rake确实不应该在gemfile中。 – 2012-01-19 00:12:17

+0

我的系统中没有“capistrano”这样的用户。这是第一个。我每次尝试运行'rake RAILS_ENV = production db:schema:load'时都会出现错误'找不到耙子',这是第二个。 – ExiRe 2012-01-20 11:55:58

0

试试这个:

RAILS_ENV=production bundle exec rake db:schema:load 

它需要打捆的上下文中运行耙。

+0

不,它没有帮助。 '在任何源中找不到rake-0.9.2.2' – ExiRe 2012-01-18 18:58:54

+0

您是否像在deploy.rb文件中设置的用户那样运行它(在本例中为root)? – 2012-01-18 19:07:00

+0

是的,我做的!我通过ssh来做,而且我是'root'用户。 – ExiRe 2012-01-18 19:10:56

0

而不是根,我相信你必须做它作为capistrano。试试这个:

sudo su capistrano 

然后输入您的密码,并做

rake RAILS_ENV=production db:schema:load