nil的未定义方法`configure'是什么:NilClass(NoMethodError)是什么意思?

时间:2017-10-14 09:04:17

标签: ruby-on-rails ruby git rvm

nil的未定义方法`configure'是什么:NilClass(NoMethodError)是什么意思?

我尝试重新安装并重新安装。我也无法将GEMFILE更新为ruby 2.4.2。您的Ruby版本是2.4.2,但您的Gemfile指定为2.2.5。我尝试了“捆绑更新”删除2.2.5,但它给了我一个错误......我尝试了一切。现在我得到这个零:Nil:Class error ... PLease help!

我做的最后一个已知错误是删除了.ds-store,我输入了一些添加gitignore的东西,因为我在使用git pull时遇到了麻烦。我在排除故障时找到了这个,我也点击了git commit - m“”。

这是当nil:Nil:Class错误弹出的每种类型我试图运行rails s。

/Users/sandychow/roughhouse-web/config/application.rb:10:in `<top (required)>': undefined method `configure' for nil:NilClass (NoMethodError)
    from /Users/sandychow/.rvm/gems/ruby-2.2.5/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:78:in `require'
    from /Users/sandychow/.rvm/gems/ruby-2.2.5/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:78:in `block in server'
    from /Users/sandychow/.rvm/gems/ruby-2.2.5/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:75:in `tap'
    from /Users/sandychow/.rvm/gems/ruby-2.2.5/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:75:in `server'
    from /Users/sandychow/.rvm/gems/ruby-2.2.5/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
    from /Users/sandychow/.rvm/gems/ruby-2.2.5/gems/railties-4.2.0/lib/rails/commands.rb:17:in `<top (required)>'
    from /Users/sandychow/roughhouse-web/bin/rails:8:in `require'
    from /Users/sandychow/roughhouse-web/bin/rails:8:in `<top (required)>'
    from /Users/sandychow/.rvm/gems/ruby-2.2.5/gems/spring-1.1.3/lib/spring/client/rails.rb:27:in `load'
    from /Users/sandychow/.rvm/gems/ruby-2.2.5/gems/spring-1.1.3/lib/spring/client/rails.rb:27:in `call'
    from /Users/sandychow/.rvm/gems/ruby-2.2.5/gems/spring-1.1.3/lib/spring/client/command.rb:7:in `call'
    from /Users/sandychow/.rvm/gems/ruby-2.2.5/gems/spring-1.1.3/lib/spring/client.rb:26:in `run'
    from /Users/sandychow/.rvm/gems/ruby-2.2.5/gems/spring-1.1.3/bin/spring:48:in `<top (required)>'
    from /Users/sandychow/.rvm/gems/ruby-2.2.5/gems/spring-1.1.3/lib/spring/binstub.rb:11:in `load'
    from /Users/sandychow/.rvm/gems/ruby-2.2.5/gems/spring-1.1.3/lib/spring/binstub.rb:11:in `<top (required)>'
    from /Users/sandychow/roughhouse-web/bin/spring:16:in `require'
    from /Users/sandychow/roughhouse-web/bin/spring:16:in `<top (required)>'
    from bin/rails:3:in `load'
    from bin/rails:3:in `<main>'
Sandys-MBP:roughhouse-web sandychow$ 

1 个答案:

答案 0 :(得分:0)

你使用什么Ruby版本管理器,我建议你使用rvm来维护ruby管理器,并使用rvm使用ruby~2.2.5,就像你的gem文件中提到的那样。首先转到项目目录并将ruby版本更改为2.2.5,然后运行bundle update。这可能会解决您的问题。 RVM