我在 Daniel Kehoe 的learn-rails 教程的开头,我刚刚尝试启动服务器。到目前为止,我唯一做的就是从 github 存储库中复制 gemfile,以确保所有版本都相同(不确定这是否正确)。现在,当尝试启动 rails 服务器时,出现以下错误:
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>
我对 Gemfile 所做的唯一更改是将 ruby 的版本从 2.4.1 版本更改为我拥有的 2.2.6 版本。
宝石文件:
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
我还应该提到我正在使用 Windows 10 和 Rails 版本 5.0.6。我不确定这是否是错误的原因,因为本教程使用了较新的版本。