Using the ‘Learn Ruby on Rails’ book, why won't my Rails server start?

51 views Asked by At

I am at the start of Daniel Kehoe's learn-rails tutorial book and I have just tried starting the server. The only thing I have done so far is to copy the gemfile from the github repository to make sure all versions are the same (not sure if this was the right thing to do). Now when trying to start the rails server I get the following error:

C:\Sites\learn-rails>rails s
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.14.5/lib/bundler/rubygems_ext.rb:45:in `full_gem_path': uninitialized constant Bundler::Plugin::API::Source (NameError)
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/rubygems/basic_specification.rb:145:in `block in full_require_paths'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/rubygems/basic_specification.rb:144:in `map'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/rubygems/basic_specification.rb:144:in `full_require_paths'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/rubygems/basic_specification.rb:77:in `contains_requirable_file?'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/rubygems/specification.rb:949:in `block in find_in_unresolved'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/rubygems/specification.rb:949:in `each'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/rubygems/specification.rb:949:in `find_all'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/rubygems/specification.rb:949:in `find_in_unresolved'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:74:in `require'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.14.5/lib/bundler/plugin/api/source.rb:2:in `<top (required)>'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.14.5/lib/bundler/rubygems_ext.rb:45:in `full_gem_path'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/rubygems/basic_specification.rb:145:in `block in full_require_paths'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/rubygems/basic_specification.rb:144:in `map'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/rubygems/basic_specification.rb:144:in `full_require_paths'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/rubygems/specification.rb:1370:in `add_self_to_load_path'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/rubygems/specification.rb:1283:in `activate'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_gem.rb:67:in `block in gem'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_gem.rb:66:in `synchronize'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_gem.rb:66:in `gem'
        from C:/Sites/learn-rails/bin/spring:14:in `<top (required)>'
        from bin/rails:3:in `load'
        from bin/rails:3:in `<main>'

C:\Sites\learn-rails>

The only change I made to the Gemfile was changing the version of ruby from version 2.4.1 to the version i have which is 2.2.6.

Gemfile:

source 'https://rubygems.org'

git_source(:github) do |repo_name|
  repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
  "https://github.com/#{repo_name}.git"
end

ruby '2.2.6'
gem 'rails', '~> 5.1.2'

# Rails defaults
gem 'puma', '~> 3.7'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.2'
gem 'turbolinks', '~> 5'
gem 'jbuilder', '~> 2.5'
group :development, :test do
  gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
  gem 'capybara', '~> 2.13'
  gem 'selenium-webdriver'
end
group :development do
  gem 'web-console', '>= 3.3.0'
  gem 'listen', '>= 3.0.5', '< 3.2'
  gem 'spring'
  gem 'spring-watcher-listen', '~> 2.0.0'
end

# learn-rails
gem 'bootstrap-sass'
gem 'gibbon'
gem 'high_voltage'
gem 'jquery-rails'
group :development do
  gem 'better_errors'
  gem 'rails_layout'
end
group :development, :test do
  gem 'sqlite3'
end
group :production do
  gem 'pg'
end
group :test do
  gem 'minitest-spec-rails'
end

I should also mention that i am using windows 10 and version 5.0.6 of Rails. I am not sure if this is the reason for the error becaseu the tutorial uses a newer version.

0

There are 0 answers