【问题标题】:gems not found on target server after Capistrano deploymentCapistrano 部署后在目标服务器上找不到 gem
【发布时间】:2012-08-25 12:37:31
【问题描述】:

我使用 Capistrano 将我的 rails 3 应用程序部署到生产服务器上。部署正确,应用服务器正确重启,但是当我登录生产服务器并进入“my_path/current”时,我无法运行“rails c”:

The program 'rails' is currently not installed.  You can install it by typing:
sudo apt-get install rails

我检查了 gem 列表,但一切似乎都已正确安装。

我的 config/deploy.rb 文件是:

require "bundler/capistrano"

# Add RVM's lib directory to the load path.
$:.unshift(File.expand_path('./lib', ENV['rvm_path']))

# Load RVM's capistrano plugin.    
require "rvm/capistrano"

set :rvm_ruby_string, '1.9.3'
set :rvm_type, :user  # Don't use system-wide RVM

set :application, "MyApp"
set :repository,  "git@github.com:user/myapp.git"
set :scm, :git
set :branch, "master"
set :scm_verbose, true
set :scm_username, "user"               # GITHUB user name
set :user, "user"                     # VPS user name
set :scm_passphrase, "pass"        # VPS password
set :deploy_to, "/home/luc/be"
set :use_sudo, false

server "my_server", :web, :app, :db, :primary => true

# start / stop application server
namespace :deploy do
  task :start do
    invoke_command "cd /home/luc/be/current; bundle exec thin start -C config/thin.config"
  end
  task :stop do
    invoke_command "cd /home/luc/be/current; bundle exec thin stop -C config/thin.config"
  end
  task :restart do
    invoke_command "cd /home/luc/be/current; bundle exec thin restart -C     config/thin.config"
  end
end

【问题讨论】:

    标签: ruby-on-rails ruby ruby-on-rails-3 capistrano


    【解决方案1】:

    试试bundle exec rails c。还要检查当您在浏览器中访问该页面时会抛出什么错误(如果有)

    【讨论】:

    • 尝试使用 bundle exec 时,我收到“错误:未安装 Gem bundler,请先运行 gem install bundler。”。 bundler (1.1.3) 已正确列在“gem list”中。
    • 你碰巧在使用rvm吗?我也遇到过类似的问题
    • @Luc - 也许here 发布的解决方案会对您有所帮助。具体来说,尝试将您的环境捆绑到供应商中,这样乘客就不会对您的 gem 的路径感到困惑。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-03-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多