4

I am simply trying to go through the railsapps.org Learn Ruby on Rails book online. I have everything installed and am stuck at "Launching the Web Server" in the tutorial.

When I execute '$ rails server', I get the following:

trick420$ rails server
=> Booting WEBrick
=> Rails 4.1.0 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Notice: server is listening on all interfaces (0.0.0.0). Consider using 127.0.0.1 (--binding option)
=> Ctrl-C to shutdown server
Exiting
/Users/trick420/.rvm/gems/ruby-2.1.1@learn-rails/gems/sprockets-rails-2.1.2/lib/sprockets/railtie.rb:77:in `block in <class:Railtie>': uninitialized constant Sprockets::Rails::VERSION (NameError)
from /Users/trick420/.rvm/gems/ruby-2.1.1@learn-rails/gems/activesupport-4.1.0/lib/active_support/lazy_load_hooks.rb:36:in `call'
from /Users/trick420/.rvm/gems/ruby-2.1.1@learn-rails/gems/activesupport-4.1.0/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
from /Users/trick420/.rvm/gems/ruby-2.1.1@learn-rails/gems/activesupport-4.1.0/lib/active_support/lazy_load_hooks.rb:45:in `block in run_load_hooks'
from /Users/trick420/.rvm/gems/ruby-2.1.1@learn-rails/gems/activesupport-4.1.0/lib/active_support/lazy_load_hooks.rb:44:in `each'
from /Users/trick420/.rvm/gems/ruby-2.1.1@learn-rails/gems/activesupport-4.1.0/lib/active_support/lazy_load_hooks.rb:44:in `run_load_hooks'
from /Users/trick420/.rvm/gems/ruby-2.1.1@learn-rails/gems/railties-4.1.0/lib/rails/application/finisher.rb:64:in `block in <module:Finisher>'
from /Users/trick420/.rvm/gems/ruby-2.1.1@learn-rails/gems/railties-4.1.0/lib/rails/initializable.rb:30:in `instance_exec'
from /Users/trick420/.rvm/gems/ruby-2.1.1@learn-rails/gems/railties-4.1.0/lib/rails/initializable.rb:30:in `run'
from /Users/trick420/.rvm/gems/ruby-2.1.1@learn-rails/gems/railties-4.1.0/lib/rails/initializable.rb:55:in `block in run_initializers'
from /Users/trick420/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/tsort.rb:226:in `block in tsort_each'
from /Users/trick420/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
from /Users/trick420/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/tsort.rb:427:in `each_strongly_connected_component_from'
from /Users/trick420/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/tsort.rb:347:in `block in each_strongly_connected_component'
from /Users/trick420/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/tsort.rb:345:in `each'
from /Users/trick420/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/tsort.rb:345:in `call'
from /Users/trick420/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/tsort.rb:345:in `each_strongly_connected_component'
from /Users/trick420/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/tsort.rb:224:in `tsort_each'
from /Users/trick420/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/tsort.rb:205:in `tsort_each'
from /Users/trick420/.rvm/gems/ruby-2.1.1@learn-rails/gems/railties-4.1.0/lib/rails/initializable.rb:54:in `run_initializers'
from /Users/trick420/.rvm/gems/ruby-2.1.1@learn-rails/gems/railties-4.1.0/lib/rails/application.rb:288:in `initialize!'
from /Users/trick420/learn-rails/config/environment.rb:5:in `<top (required)>'
from /Users/trick420/learn-rails/config.ru:3:in `require'
from /Users/trick420/learn-rails/config.ru:3:in `block in <main>'
from /Users/trick420/.rvm/gems/ruby-2.1.1@learn-rails/gems/rack-1.5.2/lib/rack/builder.rb:55:in `instance_eval'
from /Users/trick420/.rvm/gems/ruby-2.1.1@learn-rails/gems/rack-1.5.2/lib/rack/builder.rb:55:in `initialize'
from /Users/trick420/learn-rails/config.ru:in `new'
from /Users/trick420/learn-rails/config.ru:in `<main>'
from /Users/trick420/.rvm/gems/ruby-2.1.1@learn-rails/gems/rack-1.5.2/lib/rack/builder.rb:49:in `eval'
from /Users/trick420/.rvm/gems/ruby-2.1.1@learn-rails/gems/rack-1.5.2/lib/rack/builder.rb:49:in `new_from_string'
from /Users/trick420/.rvm/gems/ruby-2.1.1@learn-rails/gems/rack-1.5.2/lib/rack/builder.rb:40:in `parse_file'
from /Users/trick420/.rvm/gems/ruby-2.1.1@learn-rails/gems/rack-1.5.2/lib/rack/server.rb:277:in `build_app_and_options_from_config'
from /Users/trick420/.rvm/gems/ruby-2.1.1@learn-rails/gems/rack-1.5.2/lib/rack/server.rb:199:in `app'
from /Users/trick420/.rvm/gems/ruby-2.1.1@learn-rails/gems/railties-4.1.0/lib/rails/commands/server.rb:50:in `app'
from /Users/trick420/.rvm/gems/ruby-2.1.1@learn-rails/gems/rack-1.5.2/lib/rack/server.rb:314:in `wrapped_app'
from /Users/trick420/.rvm/gems/ruby-2.1.1@learn-rails/gems/railties-4.1.0/lib/rails/commands/server.rb:130:in `log_to_stdout'
from /Users/trick420/.rvm/gems/ruby-2.1.1@learn-rails/gems/railties-4.1.0/lib/rails/commands/server.rb:67:in `start'
from /Users/trick420/.rvm/gems/ruby-2.1.1@learn-rails/gems/railties-4.1.0/lib/rails/commands/commands_tasks.rb:81:in `block in server'
from /Users/trick420/.rvm/gems/ruby-2.1.1@learn-rails/gems/railties-4.1.0/lib/rails/commands/commands_tasks.rb:76:in `tap'
from /Users/trick420/.rvm/gems/ruby-2.1.1@learn-rails/gems/railties-4.1.0/lib/rails/commands/commands_tasks.rb:76:in `server'
from /Users/trick420/.rvm/gems/ruby-2.1.1@learn-rails/gems/railties-4.1.0/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
from /Users/trick420/.rvm/gems/ruby-2.1.1@learn-rails/gems/railties-4.1.0/lib/rails/commands.rb:17:in `<top (required)>'
from /Users/trick420/learn-rails/bin/rails:8:in `require'
from /Users/trick420/learn-rails/bin/rails:8:in `<top (required)>'
from /Users/trick420/.rvm/gems/ruby-2.1.1@learn-rails/gems/spring-1.1.2/lib/spring/client/rails.rb:27:in `load'
from /Users/trick420/.rvm/gems/ruby-2.1.1@learn-rails/gems/spring-1.1.2/lib/spring/client/rails.rb:27:in `call'
from /Users/trick420/.rvm/gems/ruby-2.1.1@learn-rails/gems/spring-1.1.2/lib/spring/client/command.rb:7:in `call'
from /Users/trick420/.rvm/gems/ruby-2.1.1@learn-rails/gems/spring-1.1.2/lib/spring/client.rb:26:in `run'
from /Users/trick420/.rvm/gems/ruby-2.1.1@learn-rails/gems/spring-1.1.2/bin/spring:48:in `<top (required)>'
from /Users/trick420/.rvm/gems/ruby-2.1.1@learn-rails/gems/spring-1.1.2/lib/spring/binstub.rb:11:in `load'
from /Users/trick420/.rvm/gems/ruby-2.1.1@learn-rails/gems/spring-1.1.2/lib/spring/binstub.rb:11:in `<top (required)>'
from /Users/trick420/learn-rails/bin/spring:16:in `require'
from /Users/trick420/learn-rails/bin/spring:16:in `<top (required)>'
from bin/rails:3:in `load'
from bin/rails:3:in `<main>'

I have no ideal what the issue is as I know nothing about Rails or Ruby at this point. Quite the barrier to entry, no? It appears that there is a problem in the gem sprockets-rails, but I have no idea how to deal with that or where to start as I haven't even got started with rails.

Daniel Kehoe
  • 10,952
  • 6
  • 63
  • 82
trick420
  • 237
  • 3
  • 9

4 Answers4

3

https://github.com/rails/sprockets-rails/issues/131

Wait for a fix to be released or simply add to your Gemfile

gem 'sprockets-rails', :require => 'sprockets/rails/version'
Daniel Kehoe
  • 10,952
  • 6
  • 63
  • 82
khmm12
  • 103
  • 2
  • 7
  • Ok, so if I execute the code as above I get: `-bash: sprockets/rails/version: No such file or directory`, I must not be interpreting the above instructions correctly? – trick420 Apr 11 '14 at 20:11
  • @trick420 you need to add it to your Gemfile, not run it on the command line – house9 Apr 11 '14 at 20:27
  • Thanks for the help. I have now jacked up my rails installation because I closed my bash window, so I can't proceed until I figure that out. – trick420 Apr 11 '14 at 20:46
  • A fixed version of the sprockets-rails gem was released on April 11, 2014. Just do "bundle update." – Daniel Kehoe Apr 12 '14 at 13:23
2

The fix to sprokets-rails has been added. Use

gem update

to update your gems.

sprockets-rails should be at version 2.1.3

Then in your gemfile.lock in your Rails app, modify the following line to the updated gem version:

sprockets-rails (2.1.3)

Run

bundle install

and in the output, confirm it says:

Using sprockets-rails 2.1.3
user1498724
  • 147
  • 1
  • 1
  • 5
  • Thanks for the help. I accidentally closed my bash window and now it's telling me rails isn't installed so I can't get past bundle install... Back to the drawing board. – trick420 Apr 11 '14 at 20:45
2

The sprockets-rails team released a broken version (version 2.1.2) of the sprockets-rails gem on April 11, 2014. They released a fixed version 2.1.3 later the same day.

If you've closed your terminal window, open a new one and navigate with Unix "cd" commands to the project directory where you are building your Rails application. Update the sprockets-rails gem (and any others that are outdated) by running:

$ bundle update

Then you can continue where you were.

Good luck with learning Rails (it is not always this difficult). And welcome to Stack Overflow. Be sure to select an answer as correct to encourage the people who have helped.

Daniel Kehoe
  • 10,952
  • 6
  • 63
  • 82
0

I had to explicitly add my sprockets gem to the gemfile with the version number in order to get it to work, i.e.

gem 'sprockets', '~> 2.2.1'
CaylaG
  • 1
  • 1