【问题标题】:Why won't bundle install railties 3.2.3 on my server?为什么不在我的服务器上捆绑安装 railties 3.2.3?
【发布时间】:2012-04-12 17:54:34
【问题描述】:

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' 命令,它可以正常工作。但是部署总是以同样的方式失败。

我已尝试删除缓存目录,如 here 所示,但我不确定我是否正确执行此操作。我在服务器和我的开发环境上使用 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 缓存?

【问题讨论】:

    标签: ruby-on-rails ruby-on-rails-3 rvm bundler ruby-on-rails-3.2


    【解决方案1】:

    你可以使用

    gem pristine --all --no-extensions
    

    从头开始重新安装所有 gem。如果您在主机上使用乘客,则需要找出该 gem 缓存目录的真正位置。查看 .bashrc 的 GEM_PATH 值,我在 Dreamhost 上的是:

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

    或者,如果您在服务器上使用 RVM,则该路径可能是 rvm 正在使用的当前版本。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-02-01
      • 1970-01-01
      • 2016-02-07
      • 2018-10-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多