RVM / Cap / Bundler - 捆绑安装找不到捆绑器
RVM / Cap / Bundler - bundle install could not find bundler
我正在 运行宁 Capistrano 与 RVM,我正在尝试将我们的网络应用程序的一部分迁移到新服务器。我做了cap deploy:setup和cap deploy:check,一切似乎都很好。当我 运行 我的部署虽然我得到这个错误
triggering before callbacks for `deploy:finalize_update'
* 2016-02-12 10:48:56 executing `bundle:install'
* executing "cd /u/apps/platform934/releases/20160212174856 && bundle install --gemfile /u/apps/platform934/releases/20160212174856/Gemfile --path /u/apps/platform934/shared/bundle --deployment --quiet --without development test"
servers: ["192.168.85.144"]
[192.168.85.144] executing command
** [out :: 192.168.85.144] /home/platform934/.rvm/rubies/ruby-1.9.3-p545/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:315:in `to_specs': Could not find 'bundler' (>= 0) among 11 total gem(s) (Gem::LoadError)
** [out :: 192.168.85.144] Checked in 'GEM_PATH=/home/platform934/.rvm/gems/ruby-1.9.3-p545@platform934:/home/platform934/.rvm/gems/ruby-1.9.3-p545@global', execute `gem env` for more information
** [out :: 192.168.85.144] from /home/platform934/.rvm/rubies/ruby-1.9.3-p545/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:324:in `to_spec'
** [out :: 192.168.85.144] from /home/platform934/.rvm/rubies/ruby-1.9.3-p545/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_gem.rb:64:in `gem'
** [out :: 192.168.85.144] from /usr/local/bin/bundle:18:in `<main>'
** [out :: 192.168.85.144] from /usr/local/bin/ruby_executable_hooks1.9.1:15:in `eval'
** [out :: 192.168.85.144] from /usr/local/bin/ruby_executable_hooks1.9.1:15:in `<main>'
command finished in 168ms
*** [deploy:update_code] rolling back
* executing "rm -rf /u/apps/platform934/releases/20160212174856; true"
servers: ["192.168.85.144"]
[192.168.85.144] executing command
command finished in 142ms
failed: "rvm_path=$HOME/.rvm $HOME/.rvm/bin/rvm-shell 'ruby-1.9.3-p545@platform934' -c 'cd /u/apps/platform934/releases/20160212174856 && bundle install --gemfile /u/apps/platform934/releases/20160212174856/Gemfile --path /u/apps/platform934/shared/bundle --deployment --quiet --without development test'" on 192.168.85.144
这是我的 deploy.rb 文件。
set :stages, %w(staging production)¬
¬
set :default_stage, 'production'¬
require 'capistrano/ext/multistage'¬
¬
set :application, "platform934"¬
set :repository, "git@github.com:foo"¬
set :scm, :git¬
set :branch, 'master'¬
ssh_options[:forward_agent] = true¬
#set :user, "root"¬
#set :use_sudo, true¬
set :deploy_via, :remote_cache¬
set :ssh_options, { :forward_agent => true}¬
#set :git_enable_submodules, 1¬
default_run_options[:pty] = true¬
# RVM Setup¬
gem 'sass-rails', '= 3.2.6'¬
#$:.unshift(File.expand_path('./lib', ENV['rvm_path'])) # Add RVM's lib directory to the load path.¬
require "bundler/capistrano"¬
require "rvm/capistrano"
set :rvm_ruby_string, ENV['GEM_HOME'].gsub(/.*\//,"")¬
#set :rvm_ruby_string, '1.9.3@platform934'¬
set :rvm_type, :user¬
before 'deploy', 'rvm:install_rvm' #install rvm on target¬
before 'deploy', 'rvm:install_ruby' #install ruby on target¬
before 'deploy:setup', 'rvm:install_rvm'¬
before 'deploy:setup', 'rvm:install_ruby'¬
¬
⋅⋅⋅⋅¬
# Unicorn tasks from: http://blog.teachstreet.com/building-teachstreet/how-i-learned-to-stop-worrying-and-love-the-unicorn/¬
set :unicorn_pid, "#{shared_path}/pids/unicorn.pid"¬
namespace :unicorn do¬
desc "start unicorn"¬
task :start, :roles => :app, :except => { :no_release => true } do¬
run "cd #{current_path} && bundle exec unicorn -c #{current_path}/config/unicorn-#{rails_env}.rb -E #{rails_env} -D"¬
end¬
desc "stop unicorn"¬
task :stop, :roles => :app, :except => { :no_release => true } do¬
run " kill `cat #{unicorn_pid}`"¬
end¬
desc "graceful stop unicorn"¬
task :graceful_stop, :roles => :app, :except => { :no_release => true } do¬
run " kill -s QUIT `cat #{unicorn_pid}`"¬
end¬
desc "reload unicorn"¬
task :reload, :roles => :app, :except => { :no_release => true } do¬
run " sleep 3; kill -s USR2 `cat #{unicorn_pid}`"¬
end¬
⋅¬
after "deploy:restart", "unicorn:reload"¬
end¬
¬
namespace :rvm do¬
task :trust_rvmrc do¬
run "rvm rvmrc trust #{release_path}"¬
end¬
after "deploy", "rvm:trust_rvmrc"¬
end¬
我对 rvm 不是很有经验,我试过手动安装 gem 但我不知道如何将它放入那个目录。我真的需要帮助,我觉得我错过了一些非常简单的东西,只是找不到适合我的在线解决方案。
RVM 在安装 ruby 后 bundler
gem 不会自动安装。
因此,每次通过 RVM 安装 Ruby 的新版本时,您都必须在之后执行 运行 gem install bundler
命令。
另一个解决方案是在 ~/.rvmrc
或 /etc/rvmrc
中编辑您的 rvmrc
配置并添加 rvm_autoinstall_bundler_flag=1
如果 Gemfile 可用,此行将强制 RVM 安装捆绑器 gem 和 运行 捆绑安装。
希望对您有所帮助:)
我正在 运行宁 Capistrano 与 RVM,我正在尝试将我们的网络应用程序的一部分迁移到新服务器。我做了cap deploy:setup和cap deploy:check,一切似乎都很好。当我 运行 我的部署虽然我得到这个错误
triggering before callbacks for `deploy:finalize_update'
* 2016-02-12 10:48:56 executing `bundle:install'
* executing "cd /u/apps/platform934/releases/20160212174856 && bundle install --gemfile /u/apps/platform934/releases/20160212174856/Gemfile --path /u/apps/platform934/shared/bundle --deployment --quiet --without development test"
servers: ["192.168.85.144"]
[192.168.85.144] executing command
** [out :: 192.168.85.144] /home/platform934/.rvm/rubies/ruby-1.9.3-p545/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:315:in `to_specs': Could not find 'bundler' (>= 0) among 11 total gem(s) (Gem::LoadError)
** [out :: 192.168.85.144] Checked in 'GEM_PATH=/home/platform934/.rvm/gems/ruby-1.9.3-p545@platform934:/home/platform934/.rvm/gems/ruby-1.9.3-p545@global', execute `gem env` for more information
** [out :: 192.168.85.144] from /home/platform934/.rvm/rubies/ruby-1.9.3-p545/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:324:in `to_spec'
** [out :: 192.168.85.144] from /home/platform934/.rvm/rubies/ruby-1.9.3-p545/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_gem.rb:64:in `gem'
** [out :: 192.168.85.144] from /usr/local/bin/bundle:18:in `<main>'
** [out :: 192.168.85.144] from /usr/local/bin/ruby_executable_hooks1.9.1:15:in `eval'
** [out :: 192.168.85.144] from /usr/local/bin/ruby_executable_hooks1.9.1:15:in `<main>'
command finished in 168ms
*** [deploy:update_code] rolling back
* executing "rm -rf /u/apps/platform934/releases/20160212174856; true"
servers: ["192.168.85.144"]
[192.168.85.144] executing command
command finished in 142ms
failed: "rvm_path=$HOME/.rvm $HOME/.rvm/bin/rvm-shell 'ruby-1.9.3-p545@platform934' -c 'cd /u/apps/platform934/releases/20160212174856 && bundle install --gemfile /u/apps/platform934/releases/20160212174856/Gemfile --path /u/apps/platform934/shared/bundle --deployment --quiet --without development test'" on 192.168.85.144
这是我的 deploy.rb 文件。
set :stages, %w(staging production)¬
¬
set :default_stage, 'production'¬
require 'capistrano/ext/multistage'¬
¬
set :application, "platform934"¬
set :repository, "git@github.com:foo"¬
set :scm, :git¬
set :branch, 'master'¬
ssh_options[:forward_agent] = true¬
#set :user, "root"¬
#set :use_sudo, true¬
set :deploy_via, :remote_cache¬
set :ssh_options, { :forward_agent => true}¬
#set :git_enable_submodules, 1¬
default_run_options[:pty] = true¬
# RVM Setup¬
gem 'sass-rails', '= 3.2.6'¬
#$:.unshift(File.expand_path('./lib', ENV['rvm_path'])) # Add RVM's lib directory to the load path.¬
require "bundler/capistrano"¬
require "rvm/capistrano"
set :rvm_ruby_string, ENV['GEM_HOME'].gsub(/.*\//,"")¬
#set :rvm_ruby_string, '1.9.3@platform934'¬
set :rvm_type, :user¬
before 'deploy', 'rvm:install_rvm' #install rvm on target¬
before 'deploy', 'rvm:install_ruby' #install ruby on target¬
before 'deploy:setup', 'rvm:install_rvm'¬
before 'deploy:setup', 'rvm:install_ruby'¬
¬
⋅⋅⋅⋅¬
# Unicorn tasks from: http://blog.teachstreet.com/building-teachstreet/how-i-learned-to-stop-worrying-and-love-the-unicorn/¬
set :unicorn_pid, "#{shared_path}/pids/unicorn.pid"¬
namespace :unicorn do¬
desc "start unicorn"¬
task :start, :roles => :app, :except => { :no_release => true } do¬
run "cd #{current_path} && bundle exec unicorn -c #{current_path}/config/unicorn-#{rails_env}.rb -E #{rails_env} -D"¬
end¬
desc "stop unicorn"¬
task :stop, :roles => :app, :except => { :no_release => true } do¬
run " kill `cat #{unicorn_pid}`"¬
end¬
desc "graceful stop unicorn"¬
task :graceful_stop, :roles => :app, :except => { :no_release => true } do¬
run " kill -s QUIT `cat #{unicorn_pid}`"¬
end¬
desc "reload unicorn"¬
task :reload, :roles => :app, :except => { :no_release => true } do¬
run " sleep 3; kill -s USR2 `cat #{unicorn_pid}`"¬
end¬
⋅¬
after "deploy:restart", "unicorn:reload"¬
end¬
¬
namespace :rvm do¬
task :trust_rvmrc do¬
run "rvm rvmrc trust #{release_path}"¬
end¬
after "deploy", "rvm:trust_rvmrc"¬
end¬
我对 rvm 不是很有经验,我试过手动安装 gem 但我不知道如何将它放入那个目录。我真的需要帮助,我觉得我错过了一些非常简单的东西,只是找不到适合我的在线解决方案。
RVM 在安装 ruby 后 bundler
gem 不会自动安装。
因此,每次通过 RVM 安装 Ruby 的新版本时,您都必须在之后执行 运行 gem install bundler
命令。
另一个解决方案是在 ~/.rvmrc
或 /etc/rvmrc
中编辑您的 rvmrc
配置并添加 rvm_autoinstall_bundler_flag=1
如果 Gemfile 可用,此行将强制 RVM 安装捆绑器 gem 和 运行 捆绑安装。
希望对您有所帮助:)