4

例如,当我调用任何 Capifony 数据库函数时cap database:move:to_remote,我会收到以下 ruby​​ 错误:

jeremykendall@isr-thinkpad-420s:~/dev/sites/app$ cap develop database:move:to_remote
    triggering load callbacks
* executing `develop'
    triggering start callbacks for `database:move:to_remote'
* executing `multistage:ensure'
* executing `database:move:to_remote'
* executing `database:dump:local'
/home/jeremykendall/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- FileUtils (LoadError)
        from /home/jeremykendall/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from /home/jeremykendall/.rvm/gems/ruby-1.9.3-p125@interperf/gems/capifony-2.1.5/lib/symfony2.rb:101:in `block (3 levels) in load'
        from /home/jeremykendall/.rvm/gems/ruby-1.9.3-p125@interperf/gems/capistrano-2.11.2/lib/capistrano/configuration/execution.rb:139:in `instance_eval'
        from /home/jeremykendall/.rvm/gems/ruby-1.9.3-p125@interperf/gems/capistrano-2.11.2/lib/capistrano/configuration/execution.rb:139:in `invoke_task_directly'
        from /home/jeremykendall/.rvm/gems/ruby-1.9.3-p125@interperf/gems/capistrano-2.11.2/lib/capistrano/configuration/callbacks.rb:25:in `invoke_task_directly_with_callbacks'
        from /home/jeremykendall/.rvm/gems/ruby-1.9.3-p125@interperf/gems/capistrano-2.11.2/lib/capistrano/configuration/execution.rb:89:in `execute_task'
        from /home/jeremykendall/.rvm/gems/ruby-1.9.3-p125@interperf/gems/capistrano-2.11.2/lib/capistrano/configuration/namespaces.rb:191:in `method_missing'
        from /home/jeremykendall/.rvm/gems/ruby-1.9.3-p125@interperf/gems/capistrano-2.11.2/lib/capistrano/configuration/namespaces.rb:191:in `method_missing'
        from /home/jeremykendall/.rvm/gems/ruby-1.9.3-p125@interperf/gems/capistrano-2.11.2/lib/capistrano/configuration/namespaces.rb:110:in `block in define_task'
        from /home/jeremykendall/.rvm/gems/ruby-1.9.3-p125@interperf/gems/capifony-2.1.5/lib/symfony2.rb:159:in `block (3 levels) in load'
        from /home/jeremykendall/.rvm/gems/ruby-1.9.3-p125@interperf/gems/capistrano-2.11.2/lib/capistrano/configuration/execution.rb:139:in `instance_eval'
        from /home/jeremykendall/.rvm/gems/ruby-1.9.3-p125@interperf/gems/capistrano-2.11.2/lib/capistrano/configuration/execution.rb:139:in `invoke_task_directly'
        from /home/jeremykendall/.rvm/gems/ruby-1.9.3-p125@interperf/gems/capistrano-2.11.2/lib/capistrano/configuration/callbacks.rb:25:in `invoke_task_directly_with_callbacks'
        from /home/jeremykendall/.rvm/gems/ruby-1.9.3-p125@interperf/gems/capistrano-2.11.2/lib/capistrano/configuration/execution.rb:89:in `execute_task'
        from /home/jeremykendall/.rvm/gems/ruby-1.9.3-p125@interperf/gems/capistrano-2.11.2/lib/capistrano/configuration/execution.rb:101:in `find_and_execute_task'
        from /home/jeremykendall/.rvm/gems/ruby-1.9.3-p125@interperf/gems/capistrano-2.11.2/lib/capistrano/cli/execute.rb:46:in `block in execute_requested_actions'
        from /home/jeremykendall/.rvm/gems/ruby-1.9.3-p125@interperf/gems/capistrano-2.11.2/lib/capistrano/cli/execute.rb:45:in `each'
        from /home/jeremykendall/.rvm/gems/ruby-1.9.3-p125@interperf/gems/capistrano-2.11.2/lib/capistrano/cli/execute.rb:45:in `execute_requested_actions'
        from /home/jeremykendall/.rvm/gems/ruby-1.9.3-p125@interperf/gems/capistrano-2.11.2/lib/capistrano/cli/help.rb:19:in `execute_requested_actions_with_help'
        from /home/jeremykendall/.rvm/gems/ruby-1.9.3-p125@interperf/gems/capistrano-2.11.2/lib/capistrano/cli/execute.rb:34:in `execute!'
        from /home/jeremykendall/.rvm/gems/ruby-1.9.3-p125@interperf/gems/capistrano-2.11.2/lib/capistrano/cli/execute.rb:14:in `execute'
        from /home/jeremykendall/.rvm/gems/ruby-1.9.3-p125@interperf/gems/capistrano-2.11.2/bin/cap:4:in `<top (required)>'
        from /home/jeremykendall/.rvm/gems/ruby-1.9.3-p125@interperf/bin/cap:19:in `load'
        from /home/jeremykendall/.rvm/gems/ruby-1.9.3-p125@interperf/bin/cap:19:in `<main>'

我的部署.rb:

set :stage_dir,       'app/config/deploy'
require 'capistrano/ext/multistage'
set :stages,          %w{production testing develop}

default_run_options[:pty] = true

set :application,     "appname"
set :deploy_to,       "/home/isr/sites/app"
set :deploy_via,      :remote_cache

set :scm,             :git
set :repository,      "git@github.com:jeremykendall/redacted.git"
set :user,            "isr"
set :use_sudo,        false

ssh_options[:forward_agent] = true

set :model_manager,   "doctrine"
set :keep_releases,   3
set :update_vendors,  true
set :shared_files,    ["app/config/parameters.yml", "app/config/parameters.ini"]
set :shared_children, [app_path + "/logs", app_path + "/cache", web_path + "/uploads", "vendor"]

我的 app/config/deploy/develop.rb

# Deploys to local vagrant box

set  :domain,           "192.168.33.10"
set  :symfony_env_prod, "dev"
set  :deploy_to,        "/home/vagrant/sites/app"
set  :branch,           "develop"
set  :user,             "vagrant"

role :web,              domain                   # Your HTTP server, Apache/etc
role :app,              domain                   # This may be the same as your `Web` server
role :db,               domain, :primary => true # This is where Rails migrations will run

我试过的

  • gem install fileutils
  • sudo aptitude install libfileutils-ocaml-dev(抓住 FileUtils 吸管)
  • gem update --system
  • gem update
4

5 回答 5

9

看起来这是capifony 2.1.5 中的错误。尝试 greppingrequire "FileUtils"并替换为require "fileutils". 那还是等待补丁?

于 2012-04-12T02:06:15.433 回答
4

你会发现它require 'FileUtils'通常可以在 Mac OS X 上运行,但是它应该是小写fileutils的。问题是大多数使用 Mac OS X 和不区分大小写的文件系统,因此当您部署或移动到 linux 或其他文件系统(如 ZFS)并打开区分大小写时,它将失败。

于 2012-06-04T22:24:56.830 回答
2

由于 FileUtils 是 corelib 的一部分,因此它应该存在于任何 ruby​​ 安装中,前提是它可以在您使用 RVM 安装 ruby​​ 时编译它。我自己也遇到了类似的问题,其中一些 corelib 不存在,当我使用 RVM 编译 ruby​​ 时,我没有安装一些依赖项。

这些是所有 ruby​​ corelib 功能的全部要求,以及 RVM 所需的一些功能。(发现使用rvm requirements

apt-get install build-essential openssl libreadline6 libreadline6-dev curl git-core  zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev  autoconf libc6-dev ncurses-dev automake libtool bison subversion

现在,完全删除 ruby​​ 和源,然后重新安装。(否则,以前的配置选项可能不会被取消设置并让您留在同一个地方)

rvm reinstall 1.9.3-p125
于 2012-04-11T22:16:03.483 回答
0

前几天晚上我在尝试 gem install rails 时遇到了一个类似的错误,结果我错误地信任 apt-get 来获得我需要的一切。

我敢打赌,在安装软件包并确保它们确实是你想要的东西时,你会比我小心一点,但这是我安装的(大致)修复它的东西。

sudo apt-get install ruby-full build-essential

sudo aptitude install ruby build-essential libopenssl-ruby ruby1.8-dev

于 2012-04-11T15:09:01.827 回答
0

您有一个用于 symphony 部署的 gem,它会自动添加到您的部署中:

gem uninstall capifony

使用gemsetsbundler exec capistrano ...解决这个问题

于 2012-04-11T22:02:38.773 回答