如何解决错误`expand_string':在Amazon EC2中部署时橡胶中的nil:NilClass(NoMethodError)的未定义方法`reject'?

时间:2015-06-05 10:14:09

标签: ruby-on-rails ruby-on-rails-4 amazon-web-services amazon-ec2 rubber

我正在使用“橡胶”在“Amazon EC2”中部署我的项目。我正在关注railscasts剧集#347 Rubber and Amazon EC2。但是当我尝试这个命令时

$cap rubber:create_staging

要求

用于登台实例[production]的主机名:

现在当我输入它时会出现错误

/home/ec2-user/.rvm/gems/ruby-2.2.2/gems/rubber-2.0.1/lib/rubber/environment.rb:137:in `expand_string': undefined method `reject' for nil:NilClass (NoMethodError)

我该如何解决这个问题?如果有任何想法,请与我分享。

代码明细:

[ec2-user@ip blog]$ cap rubber:create_staging
    triggering load callbacks
  * 2015-06-05 09:52:42 executing `rubber:init'
  * 2015-06-05 09:52:43 executing `rubber:create_staging'
Hostname to use for staging instance [production]:
/home/ec2-user/.rvm/gems/ruby-2.2.2/gems/rubber-2.0.1/lib/rubber/environment.rb:137:in `expand_string': undefined method `reject' for nil:NilClass (NoMethodError)
    from /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/rubber-2.0.1/lib/rubber/environment.rb:137:in `eval'
    from /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/rubber-2.0.1/lib/rubber/environment.rb:137:in `expand_string'
    from /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/rubber-2.0.1/lib/rubber/environment.rb:149:in `expand'
    from /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/rubber-2.0.1/lib/rubber/environment.rb:115:in `[]'
    from /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/rubber-2.0.1/lib/rubber/environment.rb:193:in `method_missing'
    from /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/rubber-2.0.1/lib/rubber/recipes/rubber/utils.rb:22:in `block (2 levels) in load'
    from /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/capistrano-2.15.5/lib/capistrano/configuration/execution.rb:138:in `instance_eval'
    from /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/capistrano-2.15.5/lib/capistrano/configuration/execution.rb:138:in `invoke_task_directly'
    from /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/capistrano-2.15.5/lib/capistrano/configuration/callbacks.rb:25:in `invoke_task_directly_with_callbacks'
    from /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/capistrano-2.15.5/lib/capistrano/configuration/execution.rb:89:in `execute_task'
    from /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/capistrano-2.15.5/lib/capistrano/configuration/execution.rb:101:in `find_and_execute_task'
    from /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/capistrano-2.15.5/lib/capistrano/cli/execute.rb:46:in `block in execute_requested_actions'
    from /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/capistrano-2.15.5/lib/capistrano/cli/execute.rb:45:in `each'
    from /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/capistrano-2.15.5/lib/capistrano/cli/execute.rb:45:in `execute_requested_actions'
    from /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/capistrano-2.15.5/lib/capistrano/cli/help.rb:19:in `execute_requested_actions_with_help'
    from /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/capistrano-2.15.5/lib/capistrano/cli/execute.rb:34:in `execute!'
    from /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/capistrano-2.15.5/lib/capistrano/cli/execute.rb:14:in `execute'
    from /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/capistrano-2.15.5/bin/cap:4:in `<top (required)>'
    from /home/ec2-user/.rvm/gems/ruby-2.2.2/bin/cap:23:in `load'
    from /home/ec2-user/.rvm/gems/ruby-2.2.2/bin/cap:23:in `<main>'
    from /home/ec2-user/.rvm/gems/ruby-2.2.2/bin/ruby_executable_hooks:15:in `eval'
    from /home/ec2-user/.rvm/gems/ruby-2.2.2/bin/ruby_executable_hooks:15:in `<main>'

0 个答案:

没有答案