【问题标题】:capistrano deployment error cap abortedcapistrano 部署错误上限中止
【发布时间】:2013-10-18 14:56:54
【问题描述】:

这是我的deploy.rb

set :application, "admin"
set :repository,  "here is my bitbucket repository"

set :scm, :git
# Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none`
set :branch, "master"

set :rails_env, "production"

set :deploy_via, :copy

set :ssh_options, { forward_agent: true, port: 2020 }

set :keep_releases, 5

server "admin.mydomain.com", :app, :web, :db, primary: true

set :deploy_to "/var/www/vhosts/admin"

我已经参考了两个配置 capistrano 的链接

link 1link 2

当我运行cap deploy:setup

我收到错误

cap aborted!
cannot load such file -- deploy
/home/seting/Documents/site/admin/Capfile:1:in `load'
/home/seting/Documents/site/admin/Capfile:1:in `<top (required)>'
/home/seting/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-3.0.0/lib/capistrano/application.rb:22:in `load_rakefile'
/home/seting/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-3.0.0/lib/capistrano/application.rb:12:in `run'
/home/seting/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-3.0.0/bin/cap:3:in `<top (required)>'
/home/seting/.rvm/gems/ruby-2.0.0-p247/bin/cap:23:in `load'
/home/seting/.rvm/gems/ruby-2.0.0-p247/bin/cap:23:in `<main>'
/home/seting/.rvm/gems/ruby-2.0.0-p247/bin/ruby_noexec_wrapper:14:in `eval'
/home/seting/.rvm/gems/ruby-2.0.0-p247/bin/ruby_noexec_wrapper:14:in `<main>'
(See full trace by running task with --trace)

编辑 1

这是我的 cap 文件

load 'deploy'
# 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

【问题讨论】:

  • 您的 deploy.rb 是否在正确的路径中? (config/deploy.rb)
  • 是的,只是它是使用 capify 命令自动生成的
  • 你能把Capfile的内容贴出来吗?
  • 您是否将 Cap V2 设置与 Cap V3 一起使用?它们不兼容。
  • @mtoast 我已经更新了我的 cap 文件,请检查一下。

标签: ruby-on-rails ruby-on-rails-3 capistrano


【解决方案1】:

如果您使用 RVM >= 1.11.3,则应将 rvm-capistrano gem 添加到您的 Gemfile,然后添加 bundle install

【讨论】:

    【解决方案2】:

    应该是

    cap deploy:setup
    

    不是

    cap:deploy:setup
    

    【讨论】:

    • 抱歉打错了
    【解决方案3】:

    在你的 capfile 的第 1 行,而不是

    load 'deploy'
    

    使用

    load 'deploy' if respond_to?(:namespace)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-04-05
      • 2015-07-22
      • 1970-01-01
      • 1970-01-01
      • 2016-05-21
      • 1970-01-01
      • 2016-10-08
      相关资源
      最近更新 更多