【发布时间】:2017-12-14 18:02:33
【问题描述】:
当我尝试从 rails 5.0 更新到 5.1 时,我有一个工作应用程序。 (我一直在从 4.2 更新到 5.0)
它不再起作用了,运行如下命令:
rails server
产生错误。我不知道如何解决这个问题,也找不到任何信息,这很奇怪,因为它指向的是伪造者的代码,而不是我的。
这是控制台输出
/home/gaston/.rvm/gems/ruby-2.3.1/gems/bundler-1.13.7/lib/bundler/runtime.rb:94:in
rescue in block (2 levels) in require': There was an error while trying to load the gem 'faker'. (Bundler::GemRequireError) Gem Load Error is: uninitialized constant Faker::Date Backtrace for gem load error is: /home/gaston/.rvm/gems/ruby-2.3.1/gems/faker-1.8.1/lib/faker/time.rb:2:in' /home/gaston/.rvm/gems/ruby-2.3.1/gems/faker-1.8.1/lib/faker/time.rb:1:in<top (required)>' /home/gaston/.rvm/gems/ruby-2.3.1/gems/faker-1.8.1/lib/faker.rb:214:inblock in ' /home/gaston/.rvm/gems/ruby-2.3.1/gems/faker-1.8.1/lib/faker.rb:214:ineach' /home/gaston/.rvm/gems/ruby-2.3.1/gems/faker-1.8.1/lib/faker.rb:214:in' /home/gaston/.rvm/gems/ruby-2.3.1/gems/bundler-1.13.7/lib/bundler/runtime.rb:91:inrequire' /home/gaston/.rvm/gems/ruby-2.3.1/gems/bundler-1.13.7/lib/bundler/runtime.rb:91:inblock(2 级)在 require' /home/gaston/.rvm/gems/ruby-2.3.1/gems/bundler-1.13.7/lib/bundler/runtime.rb:86:ineach' /home/gaston/.rvm/gems/ruby-2.3.1/gems/bundler-1.13.7/lib/bundler/runtime.rb:86:inblock in require' /home/gaston/.rvm/gems/ruby-2.3.1/gems/bundler-1.13.7/lib/bundler/runtime.rb:75:ineach' /home/gaston/.rvm/gems/ruby-2.3.1/gems/bundler-1.13.7/lib/bundler/runtime.rb:75:inrequire' /home/gaston/.rvm/gems/ruby-2.3.1/gems/bundler-1.13.7/lib/bundler.rb:106:inrequire' /home/gaston/Workspace/cloud9workspace/projects/time/config/application.rb:7:in' /home/gaston/.rvm/gems/ruby-2.3.1/gems/railties-5.1.0/lib/rails/commands/server/server_command.rb:128:inrequire' /home/gaston/.rvm/gems/ruby-2.3.1/gems/railties-5.1.0/lib/rails/commands/server/server_command.rb:128:inblock 正在执行' /home/gaston/.rvm/gems/ruby-2.3.1/gems/railties-5.1.0/lib/rails/commands/server/server_command.rb:125:intap' /home/gaston/.rvm/gems/ruby-2.3.1/gems/railties-5.1.0/lib/rails/commands/server/server_command.rb:125:in执行' /home/gaston/.rvm/gems/ruby-2.3.1/gems/thor-0.19.4/lib/thor/command.rb:27:inrun' /home/gaston/.rvm/gems/ruby-2.3.1/gems/thor-0.19.4/lib/thor/invocation.rb:126:ininvoke_command' /home/gaston/.rvm/gems/ruby-2.3.1/gems/thor-0.19.4/lib/thor.rb:369:indispatch' /home/gaston/.rvm/gems/ruby-2.3.1/gems/railties-5.1.0/lib/rails/command/base.rb:63:in执行' /home/gaston/.rvm/gems/ruby-2.3.1/gems/railties-5.1.0/lib/rails/command.rb:44:ininvoke' /home/gaston/.rvm/gems/ruby-2.3.1/gems/railties-5.1.0/lib/rails/commands.rb:16:in' /home/gaston/Workspace/cloud9workspace/projects/time/bin/rails:9:inrequire' /home/gaston/Workspace/cloud9workspace/projects/time/bin/rails:9:in' /home/gaston/.rvm/gems/ruby-2.3.1/gems/spring-2.0.2/lib/spring/client/rails.rb:28:inload' /home/gaston/.rvm/gems/ruby-2.3.1/gems/spring-2.0.2/lib/spring/client/rails.rb:28:incall' /home/gaston/.rvm/gems/ruby-2.3.1/gems/spring-2.0.2/lib/spring/client/command.rb:7:incall' /home/gaston/.rvm/gems/ruby-2.3.1/gems/spring-2.0.2/lib/spring/client.rb:30:inrun' /home/gaston/.rvm/gems/ruby-2.3.1/gems/spring-2.0.2/bin/spring:49:in<top (required)>' /home/gaston/.rvm/gems/ruby-2.3.1/gems/spring-2.0.2/lib/spring/binstub.rb:31:inload' /home/gaston/.rvm/gems/ruby-2.3.1/gems/spring-2.0.2/lib/spring/binstub.rb:31:in<top (required)>' /home/gaston/Workspace/cloud9workspace/projects/time/bin/spring:13:inrequire' /home/gaston/Workspace/cloud9workspace/projects/time/bin/spring:13:in<top (required)>' bin/rails:3:inload' bin/rails:3:in<main>' Bundler Error Backtrace: from /home/gaston/.rvm/gems/ruby-2.3.1/gems/bundler-1.13.7/lib/bundler/runtime.rb:90:inblock (2 个级别) in require' 来自/home/gaston/.rvm/gems/ruby-2.3.1/gems/bundler-1.13.7/lib/bundler/runtime.rb:86:ineach' from /home/gaston/.rvm/gems/ruby-2.3.1/gems/bundler-1.13.7/lib/bundler/runtime.rb:86:inblock in require' 来自/home/gaston/.rvm/gems/ruby-2.3.1/gems/bundler-1.13.7/lib/bundler/runtime.rb:75:ineach' from /home/gaston/.rvm/gems/ruby-2.3.1/gems/bundler-1.13.7/lib/bundler/runtime.rb:75:in要求' 来自/home/gaston/.rvm/gems/ruby-2.3.1/gems/bundler-1.13.7/lib/bundler.rb:106:inrequire' from /home/gaston/Workspace/cloud9workspace/projects/time/config/application.rb:7:in' 来自/home/gaston/.rvm/gems/ruby-2.3.1/gems/railties-5.1.0/lib/rails/commands/server/server_command.rb:128:inrequire' from /home/gaston/.rvm/gems/ruby-2.3.1/gems/railties-5.1.0/lib/rails/commands/server/server_command.rb:128:inblock 正在执行' 来自/home/gaston/.rvm/gems/ruby-2.3.1/gems/railties-5.1.0/lib/rails/commands/server/server_command.rb:125:intap' from /home/gaston/.rvm/gems/ruby-2.3.1/gems/railties-5.1.0/lib/rails/commands/server/server_command.rb:125:in执行' 来自/home/gaston/.rvm/gems/ruby-2.3.1/gems/thor-0.19.4/lib/thor/command.rb:27:inrun' from /home/gaston/.rvm/gems/ruby-2.3.1/gems/thor-0.19.4/lib/thor/invocation.rb:126:ininvoke_command' 来自/home/gaston/.rvm/gems/ruby-2.3.1/gems/thor-0.19.4/lib/thor.rb:369:indispatch' from /home/gaston/.rvm/gems/ruby-2.3.1/gems/railties-5.1.0/lib/rails/command/base.rb:63:in执行' 来自/home/gaston/.rvm/gems/ruby-2.3.1/gems/railties-5.1.0/lib/rails/command.rb:44:ininvoke' from /home/gaston/.rvm/gems/ruby-2.3.1/gems/railties-5.1.0/lib/rails/commands.rb:16:in' 来自 /home/gaston/Workspace/cloud9workspace/projects/time/bin/rails:9:inrequire' from /home/gaston/Workspace/cloud9workspace/projects/time/bin/rails:9:in' 来自/home/gaston/.rvm/gems/ruby-2.3.1/gems/spring-2.0.2/lib/spring/client/rails.rb:28:inload' from /home/gaston/.rvm/gems/ruby-2.3.1/gems/spring-2.0.2/lib/spring/client/rails.rb:28:incall' 来自/home/gaston/.rvm/gems/ruby-2.3.1/gems/spring-2.0.2/lib/spring/client/command.rb:7:incall' from /home/gaston/.rvm/gems/ruby-2.3.1/gems/spring-2.0.2/lib/spring/client.rb:30:inrun' 来自/home/gaston/.rvm/gems/ruby-2.3.1/gems/spring-2.0.2/bin/spring:49:in<top (required)>' from /home/gaston/.rvm/gems/ruby-2.3.1/gems/spring-2.0.2/lib/spring/binstub.rb:31:inload' 来自/home/gaston/.rvm/gems/ruby-2.3.1/gems/spring-2.0.2/lib/spring/binstub.rb:31:in<top (required)>' from /home/gaston/Workspace/cloud9workspace/projects/time/bin/spring:13:inrequire' 来自/home/gaston/Workspace/cloud9workspace/projects/time/bin/spring:13:in<top (required)>' from bin/rails:3:inload' 从 bin/rails:3:in `'
这是我的文件: spring.rb
#!/usr/bin/env ruby
# This file loads spring without using Bundler, in order to be fast.
# It gets overwritten when you run the `spring binstub` command.
unless defined?(Spring)
require 'rubygems'
require 'bundler'
if (match = Bundler.default_lockfile.read.match(/^GEM$.*?^ (?: )*spring \((.*?)\)$.*?^$/m))
Gem.paths = { 'GEM_PATH' => [Bundler.bundle_path.to_s, *Gem.path].uniq.join(Gem.path_separator) }
gem 'spring', match[1]
require 'spring/binstub'
end
end
Faker 已经包含在 gemfile 中,我已经更新到最新版本。 宝石文件
gem 'faker', '~> 1.8', '>= 1.8.1'
这是我的 application.rb,(前 7 行) 应用程序.rb
require File.expand_path('../boot', __FILE__)
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
...
【问题讨论】:
标签: ruby-on-rails