zeus: cannot load such file -- rails/commands/console

Hi, after upgrading to rails 5, I can no longer run zeus console

I get the following error:

/usr/local/bundle/gems/activesupport-5.1.0/lib/active_support/dependencies.rb:292:in `require': cannot load such file -- rails/commands/console (LoadError)
	from /usr/local/bundle/gems/activesupport-5.1.0/lib/active_support/dependencies.rb:292:in `block in require'
	from /usr/local/bundle/gems/activesupport-5.1.0/lib/active_support/dependencies.rb:258:in `load_dependency'
	from /usr/local/bundle/gems/activesupport-5.1.0/lib/active_support/dependencies.rb:292:in `require'
	from /usr/local/bundle/gems/zeus-0.15.10/lib/zeus/rails.rb:131:in `console'
	from /usr/local/bundle/gems/zeus-0.15.10/lib/zeus.rb:147:in `block in command'
	from /usr/local/bundle/gems/zeus-0.15.10/lib/zeus.rb:134:in `fork'
	from /usr/local/bundle/gems/zeus-0.15.10/lib/zeus.rb:134:in `command'
	from /usr/local/bundle/gems/zeus-0.15.10/lib/zeus.rb:50:in `go'
	from -e:1:in `<main>'

Any ideas?

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 7
  • Comments: 16

Commits related to this issue

Most upvoted comments

I ran into a similar problem. Instead of console I was trying to run server. I did some digging and here’s what I found:

The problem happens in https://github.com/burke/zeus/blob/master/rubygem/lib/zeus/rails.rb at this method:

def server
  require 'rails/commands/server'
  server = ::Rails::Server.new
  Dir.chdir(::Rails.application.root)
  server.start
end

The Rails authors changed the commands directory structure (https://github.com/rails/rails/tree/master/railties/lib/rails/commands). The path for the required file rails/commands/server has been changed to rails/commands/server/server_command.

I edited the method above to reflect this path change:

From: require 'rails/commands/server'

To: require 'rails/commands/server/server_command'

I ran Zeus and a new error appeared: uninitialized constant Rails::Command::Base. I looked around and found the definition of this constant in rails/command. So I inserted require 'rails/command' at the beginning of the method.

I reran Zeus and a new error appeared; rack-2.0.3/lib/rack/server.rb:315:in `exist?': no implicit conversion of nil into String (TypeError).

I have no idea. It seems it has something to do with the injection of options and somehow the Rake task is not receiving those options. And it seems there has been a change in how the Rails server (and possibly the other tasks as well) are setup and invoked.

However, I found a way to make it work from the Rails initialization doc at http://guides.rubyonrails.org/initialization.html.

def server
  require 'rails/command'
  ::Rails::Command.invoke 'server', ARGV
end

I don’t know if this is the right way to fix it. It’s different from the original pattern. If you want to make the other commands work, you’ll have to change the file path to the correct file path (among other things). For example, the method for the console command will have to be changed to something like:

def console
  require 'rails/command'
  require 'rails/commands/console/console_command'    

I hope this helps.

I pushed version 0.15.15.pre to be installable via gem install --pre zeus, make sure to first uninstall versions already on the system via gem uninstall zeus and uninstall all versions including binaries to make sure there is no trouble around that. Would love if someone could try it out.

Ran into the same issue and the 0.15.15.pre version fixed it. Perhaps it’s time for an official release of that version?

I ran into the same issue using the latest release of zeus with Rails 5.1 and the pre version of zeus is working great for me. Thanks!

same problem at rails 5.1.1

Here is a link to a virgin project hehe 😃 https://github.com/staycreativedesign/zeus-error

I am experiencing the same thing as well !! I try to run zeus generate and it gives that exact same error! Rails 5.1.0 ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin15]

See the PR for a rather quick and dirty fix, if somebody likes to try it out that would be great I will built a package to try as soon as I have a Mac handy to build.

I will try to create one. Thank you

Interesting I’m using it with rails 5 at the moment, and it seems to work fine, can you generate a small sample app which experiences this?