编辑#1
这是日志
** DEPLOY FAILED
** Refer to log/capistrano.log for details. Here are the last 20 lines:
DEBUG [d8da8d91] Command: if test ! -d /home/poladmin/poetry_out_loud_v2/releases/20180629192529; then echo "Directory does not exist '/home/poladmin/poetry_out_loud_v2/releases/20180629192529'" 1>&2; false; fi
DEBUG [d8da8d91] Finished in 0.495 seconds with exit status 0 (successful).
INFO [64734ae3] Running $HOME/.rbenv/bin/rbenv exec rake assets:precompile as poladmin@196.28.51.162
DEBUG [64734ae3] Command: cd /home/poladmin/poetry_out_loud_v2/releases/20180629192529 && ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.5.1" RAILS_ENV="production" RAILS_GROUPS="" ; $HOME/.rbenv/bin/rbenv exec rake assets:precompile )
DEBUG [64734ae3] rake aborted!
Bundler::GemNotFound: Could not find rake-12.3.1 in any of the sources
DEBUG [64734ae3] /home/poladmin/poetry_out_loud_v2/releases/20180629192529/config/boot.rb:3:in `<top (required)>'
/home/poladmin/poetry_out_loud_v2/releases/20180629192529/config/application.rb:1:in `require_relative'
/home/poladmin/poetry_out_loud_v2/releases/20180629192529/config/application.rb:1:in `<top (required)>'
/home/poladmin/poetry_out_loud_v2/releases/20180629192529/Rakefile:4:in `require_relative'
/home/poladmin/poetry_out_loud_v2/releases/20180629192529/Rakefile:4:in `<top (required)>'
DEBUG [64734ae3]
Caused by:
DEBUG [64734ae3] LoadError: cannot load such file -- bundler/setup
DEBUG [64734ae3] /home/poladmin/poetry_out_loud_v2/releases/20180629192529/config/boot.rb:3:in `<top (required)>'
/home/poladmin/poetry_out_loud_v2/releases/20180629192529/config/application.rb:1:in `require_relative'
/home/poladmin/poetry_out_loud_v2/releases/20180629192529/config/application.rb:1:in `<top (required)>'
/home/poladmin/poetry_out_loud_v2/releases/20180629192529/Rakefile:4:in `require_relative'
/home/poladmin/poetry_out_loud_v2/releases/20180629192529/Rakefile:4:in `<top (required)>'
bundler
gem已安装在服务器上。
原始问题
因此,我尝试使用capistrano将应用程序推送到服务器,但是rake gem出现了LoadError: cannot load such file -- bundler/setup
错误,但是本地安装了rake。这是Gemfile:
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby '2.5.1'
gem 'rails', '~> 5.2.0'
gem 'puma', '~> 3.11'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'rake', '~> 12.3', '>= 12.3.1'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'mini_racer', platforms: :ruby
gem 'coffee-rails', '~> 4.2'
gem 'turbolinks', '~> 5'
gem 'jbuilder', '~> 2.5'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 4.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
gem 'bootsnap', '>= 1.1.0', require: false
gem 'mongoid'
group :development, :test do
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
end
group :development do
gem 'web-console', '>= 3.3.0'
gem 'listen', '>= 3.0.5', '< 3.2'
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
gem 'capistrano', '~> 3.7', '>= 3.7.1'
gem 'capistrano-rails', '~> 1.2'
gem 'capistrano-passenger', '~> 0.2.0'
gem 'capistrano-rbenv', '~> 2.1'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
感谢您的帮助。
答案 0 :(得分:0)
尝试在gemfile中要求false。
gem "capistrano", "~> 3.7", require: false
gem "capistrano-rails", "~> 1.2", require: false
答案 1 :(得分:0)
如果您使用的是rbenv
或类似版本,则捆绑程序和gems可能安装在与部署登录名不同的环境中。您需要告诉Cap。我用这个:
set :rbenv_ruby, '2.4.1'
set :rbenv_path, '/Users/stmpjmpr/.rbenv'
set :rbenv_prefix, "RBENV_ROOT=#{fetch(:rbenv_path)} RBENV_VERSION=#{fetch(:rbenv_ruby)} /usr/local/bin/rbenv exec"