【问题标题】:cannot load such file -- bundler/setup - Capistrano无法加载此类文件 - 捆绑器/设置 - Capistrano
【发布时间】:2015-06-22 07:12:00
【问题描述】:

我正在尝试通过 capistrano 学习部署。当我运行部署脚本时,除了迁移之外一切正常。

我收到以下错误。

INFO [175f4b0b] Running /usr/bin/env rake db:migrate as 

prajeesh@xx.x.x.xxx
DEBUG [175f4b0b] Command: cd /home/prajeesh/Desktop/projects/capistrano_staging/current && ( RAILS_ENV=development /usr/bin/env rake db:migrate )
DEBUG [175f4b0b]    rake aborted!
DEBUG [175f4b0b]    

cannot load such file -- bundler/setup

Capfile

# Load DSL and set up stages
require 'capistrano/setup'

# Include default deployment tasks
require 'capistrano/deploy'
#require 'capistrano/rails/assets'
require 'capistrano/rails/migrations'

# Load custom tasks from `lib/capistrano/tasks` if you have any defined
Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }

部署文件

# config valid only for current version of Capistrano
lock '3.4.0'

set :application, 'capistrano_study'
set :repo_url, 'https://github.com/xxxxxxxx/capistrano_study.git'

# config valid only for current version of Capistrano
set :stages, ["development","staging", "production"]
set :default_stage, "development"
set :user, "prajeesh"
after "deploy:updated", "deploy:migrate"

 set :keep_releases, 5

namespace :deploy do
  after :restart, :clear_cache do
    on roles(:web), in: :groups, limit: 3, wait: 10 do
      # Here we can do anything such as:
      # within release_path do
      #   execute :rake, 'cache:clear'
      # end
    end
  end
end

如果我直接从项目路径运行命令 RAILS_ENV=development /usr/bin/env rake db:migrate,则迁移正在运行,但通过 capistrano 无法正常工作。

任何帮助将不胜感激。

【问题讨论】:

  • 如果可能的话,请给你看 Capfile 和 config/deploy.rb
  • 添加了所需的详细信息
  • 我认为你错过了github.com/capistrano/bundler
  • 把它放在 'capistrano/rails' 之前,你就可以开始了
  • 我确实喜欢你提到的方式。现在我收到以下错误。 DEBUG [62438a71] /usr/bin/env: DEBUG [62438a71] bundle DEBUG [62438a71] : 没有这样的文件或目录

标签: ruby-on-rails capistrano3


【解决方案1】:

这是你的答案:

安装以下 gem:

gem 'capistrano-rails', '~> 1.1'

并且需要打包任务

# Capfile
require 'capistrano/bundler' # Rails needs Bundler, right?
require 'capistrano/rails/assets'
require 'capistrano/rails/migrations'

来源: https://github.com/capistrano/rails/

【讨论】:

    【解决方案2】:

    我所要做的就是安装 gem 'capistrano-rvm' 并在 cap 文件中要求它

    【讨论】:

      猜你喜欢
      • 2013-10-04
      • 2014-11-23
      • 1970-01-01
      • 2016-01-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多