0

I've just woken up and can't start the rails server using rails s. I get the following error:

$ rails s
c:/Sites/wtna/config/application.rb:9:in `<top (required)>': undefined local variable or method `config' for main:Object (NameError)
    from C:/RailsInstaller/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-5.1.6/lib/rails/commands/server/server_command.rb:133:in `require'
    from C:/RailsInstaller/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-5.1.6/lib/rails/commands/server/server_command.rb:133:in `block in perform'
    from C:/RailsInstaller/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-5.1.6/lib/rails/commands/server/server_command.rb:130:in `tap'
    from C:/RailsInstaller/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-5.1.6/lib/rails/commands/server/server_command.rb:130:in `perform'
    from C:/RailsInstaller/Ruby22-x64/lib/ruby/gems/2.2.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
    from C:/RailsInstaller/Ruby22-x64/lib/ruby/gems/2.2.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
    from C:/RailsInstaller/Ruby22-x64/lib/ruby/gems/2.2.0/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch'
    from C:/RailsInstaller/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-5.1.6/lib/rails/command/base.rb:63:in `perform'
    from C:/RailsInstaller/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-5.1.6/lib/rails/command.rb:44:in `invoke'
    from C:/RailsInstaller/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-5.1.6/lib/rails/commands.rb:16:in `<top (required)>'
    from bin/rails:4:in `require'
    from bin/rails:4:in `<main>'

All was running fine 10 hours ago. Any suggestions?

MSC
  • 3,286
  • 5
  • 29
  • 47
  • can you post your code from your `application.rb` file as well? it could be that the `config` variable is being tried to be accessed outside the scope where it was defined. – John Baker Aug 28 '18 at 22:20
  • did you change something in the last 10 hours? did someone else change something and you pulled it down with a git/svn update? – Billy Kimble Aug 28 '18 at 22:38
  • Thanks, guys. There was a line I had added yesterday to application.rb which, once commented out, gets me running again (see below). – MSC Aug 28 '18 at 23:55

1 Answers1

0

It turns out that commenting out the following line in config/application.rb (which I took from dotdotdotPaul: How can I completely disable CoffeeScript in a Rails 3.1 app?) cured the problem:

config.generators.javascript_engine :js
MSC
  • 3,286
  • 5
  • 29
  • 47