简体   繁体   English

为什么不在我的服务器上捆绑安装railties 3.2.3?

[英]Why won't bundle install railties 3.2.3 on my server?

Rails 3.2.2 has been working fine in both my development environment, and on my server. Rails 3.2.2在我的开发环境和我的服务器上都运行良好。

I'm trying to upgrade to 3.2.3 by changing: 我正在尝试通过更改升级到3.2.3:

gem 'rails', '3.2.2'

to

gem 'rails', '3.2.3'

then running: 然后运行:

bundle update
bundle

All goes well until I try to deploy to my server. 一切顺利,直到我尝试部署到我的服务器。 During the deploy, I get this message: 在部署期间,我收到以下消息:

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.

I have logged into the server and ran the gem install railties -v '3.2.3' command and it works without problems. 我已登录服务器并运行gem install railties -v'3.2.3'命令,它可以正常工作。 But the deploy always fails in the same way. 但是部署总是以同样的方式失败。

I've tried to delete the cache directory as shown here , but I'm not sure I'm doing that correctly. 我试图删除如图所示的缓存目录这里 ,但我不知道我在做正确的是。 I'm using rvm on the server and my development environment. 我在服务器和我的开发环境中使用rvm。

Can anybody help point me in a direction on this? 任何人都可以指点我的方向吗?

Here's my deploy.rb file: 这是我的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"

Update 更新

I was able to finally fix this by deploying to a different user. 我最终通过部署到不同的用户来解决这个问题。 But the question still remains: How would I clear out the gem cache for the old user? 但问题仍然存在:如何清除旧用户的gem缓存?

You could use 你可以用

gem pristine --all --no-extensions

to reinstall all your gems from scratch. 从头开始重新安装所有宝石。 If you're using passenger on your host, you will need to find out where that gem cache directory is really at. 如果您在主机上使用乘客,则需要找出该gem缓存目录所在的位置。 Look at the .bashrc for GEM_PATH value, mine on Dreamhost is: 查看.bashrc中的GEM_PATH值,我的Dreamhost是:

export GEM_PATH="$GEM_HOME:/usr/lib/ruby/gems/1.8"

Or if you're using RVM on your server, that path is likely to the current version rvm is using. 或者,如果您在服务器上使用RVM,则该路径可能是rvm正在使用的当前版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM