[英]Why won't bundle install railties 3.2.3 on my server?
Rails 3.2.2在我的開發環境和我的服務器上都運行良好。
我正在嘗試通過更改升級到3.2.3:
gem 'rails', '3.2.2'
至
gem 'rails', '3.2.3'
然后運行:
bundle update
bundle
一切順利,直到我嘗試部署到我的服務器。 在部署期間,我收到以下消息:
An error occured while installing railties (3.2.3), and Bundler cannot continue.
Make sure that `gem install railties -v '3.2.3'` succeeds before bundling.
我已登錄服務器並運行gem install railties -v'3.2.3'命令,它可以正常工作。 但是部署總是以同樣的方式失敗。
我試圖刪除如圖所示的緩存目錄這里 ,但我不知道我在做正確的是。 我在服務器和我的開發環境中使用rvm。
任何人都可以指點我的方向嗎?
這是我的deploy.rb文件:
require "bundler/capistrano"
$:.unshift(File.expand_path('./lib', ENV['rvm_path'])) # Add RVM's lib directory to the load path.
require "rvm/capistrano" # Load RVM's capistrano plugin.
set :application, "teamsite"
set :repository, "git@github.com:user/teamsite.git"
set :deploy_to, "/home/website.com/rails/application/"
set :user, "website.com"
set :scm, :git
set :use_sudo, false
default_run_options[:pty] = true
set :branch, "master"
set :scm_verbose, true
set :deploy_via, :remote_cache
ssh_options[:forward_agent] = true
task :staging do
role :web, "staging.website.com"
role :app, "staging.website.com"
role :db, "staging.website.com", :primary => true
end
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
namespace :assets do
task :precompile, :roles => :web, :except => { :no_release => true } do
from = source.next_revision(current_revision)
if capture("cd #{latest_release} && #{source.local.log(from)} vendor/assets/ app/assets/ | wc -l").to_i > 0
run %Q{cd #{latest_release} && #{rake} RAILS_ENV=#{rails_env} #{asset_env} assets:precompile}
else
logger.info "Skipping asset pre-compilation because there were no asset changes"
end
end
end
end
namespace :customs do
task :create_symlink, :roles => :app do
run <<-CMD
ln -nfs #{shared_path}/files #{release_path}/files
CMD
run <<-CMD
ln -nfs #{shared_path}/drawings #{release_path}/drawings
CMD
run <<-CMD
ln -nfs #{shared_path}/photos #{release_path}/photos
CMD
end
end
after "deploy:create_symlink","customs:create_symlink"
after "deploy", "deploy:cleanup"
更新
我最終通過部署到不同的用戶來解決這個問題。 但問題仍然存在:如何清除舊用戶的gem緩存?
你可以用
gem pristine --all --no-extensions
從頭開始重新安裝所有寶石。 如果您在主機上使用乘客,則需要找出該gem緩存目錄所在的位置。 查看.bashrc中的GEM_PATH值,我的Dreamhost是:
export GEM_PATH="$GEM_HOME:/usr/lib/ruby/gems/1.8"
或者,如果您在服務器上使用RVM,則該路徑可能是rvm正在使用的當前版本。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.