首页 文章

未初始化的常量Faker :: Date更新到rails 5.1

提问于
浏览
1

当我尝试从rails 5.0更新到5.1时,我有一个工作的应用程序 . (我一直在从4.2更新到5.0)

它不再起作用,运行如下命令:

rails server

产生错误 . 我不知道如何解决这个问题,而且我找不到任何信息,这很奇怪,因为它指向了faker的代码,而不是我的代码 .

这是控制台输出

/home/gaston/.rvm/gems/ruby-2.3.1/gems/bundler-1.13.7/lib/bundler/runtime.rb:94:in block in block(2 level)in require':有一个尝试加载gem'faker'时出错 . (Bundler :: GemRequireError)Gem Load Error是:未初始化的常量Faker :: Date Backtrace for gem load error是:/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(必填) >'/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 / faker-1.8.1 / lib / faker.rb:214:在每个'/home/gaston/.rvm/gems/ruby-2.3.1/gems/faker-1.8.1/lib/faker中.rb:214:在'/home/gaston/.rvm/gems/ruby-2.3.1/gems/bundler-1.13.7/lib/bundler/runtime.rb:91:in require'/ home / gaston / . rvm / gems / ruby-2.3.1 / gems / bundler-1.13.7 / lib / bundler / runtime.rb:91:在require'/home/gaston/.rvm/gems/ruby-2.3中的块(2级) .1 / gems / bundler-1.13.7 / lib / bundler / runtime.rb:86:在每个'/home/gaston/.rvm/gems/ruby-2.3.1/gems/bundler-1.13.7/lib/ bundler / runtime.rb:86:在需要'/home/gaston/.rvm/gems/ruby-2.3.1/gems/bundler-1.13.7/lib/bundler/runtime.rb:75:in'中的块中/ HO me / gaston / .rvm / gems / ruby-2.3.1 / gems / bundler-1.13.7 / lib / bundler / runtime.rb:75:in require'/home/gaston/.rvm/gems/ruby-2.3 . 1 / gems / bundler-1.13.7 / lib / bundler.rb:106:在require'/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:in require'/home/gaston/.rvm/gems/ruby-2.3.1 /gems/railties-5.1.0/lib/rails/commands/server/server_command.rb:128:in block in perform'/home/gaston/.rvm/gems/ruby-2.3.1/gems/railties-5.1 . 0 / lib / rails / commands / server / server_command.rb:125:点击'/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:in run'/ home / gaston / .rvm / gems / ruby-2.3.1 / gems / thor-0.19.4 / lib / thor / invocation.rb:126:in invoke_command'/home/gaston/.rvm/gems/ruby-2.3.1/ gems / thor-0.19.4 / lib / thor.rb:369:in dispatch'/home/gaston/.rvm/gems/r uby-2.3.1 / gems / railties-5.1.0 / lib / rails / command / base.rb:63:in perform'/home/gaston/.rvm/gems/ruby-2.3.1/gems/railties-5.1 .0 / lib / rails / command.rb:44:在调用'/home/gaston/.rvm/gems/ruby-2.3.1/gems/railties-5.1.0/lib/rails/commands.rb:16:在'/ home / gaston / Workspace / cloud9workspace / projects / time / bin / rails:9:in require'/ 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:in load'/home/gaston/.rvm/gems/ruby-2.3.1/ gems / spring-2.0.2 / lib / spring / client / rails.rb:28:in call'/home/gaston/.rvm/gems/ruby-2.3.1/gems/spring-2.0.2/lib/spring /client/command.rb:7:in调用'/home/gaston/.rvm/gems/ruby-2.3.1/gems/spring-2.0.2/lib/spring/client.rb:30:in run'/ 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:in load'/home/gaston/.rvm/gems/ruby-2.3.1/gems/spring-2.0.2/lib/ spring / binstub.rb:31:我n <top(required)>'/ home / gaston / Workspace / cloud9workspace / projects / time / bin / spring:13:in require'/ home / gaston / Workspace / cloud9workspace / projects / time / bin / spring:13:in <top(required)>'bin / rails:3:inload'bin / rails:3:in <main>'Bundler Error Backtrace:来自/home/gaston/.rvm/gems/ruby-2.3.1/gems/bundler -1.13.7 / lib / bundler / runtime.rb:90:在block(2级)的require'from /home/gaston/.rvm/gems/ruby-2.3.1/gems/bundler-1.13.7/lib /bundler/runtime.rb:86:in每个'来自/home/gaston/.rvm/gems/ruby-2.3.1/gems/bundler-1.13.7/lib/bundler/runtime.rb:86:in in block in从/home/gaston/.rvm/gems请求'from /home/gaston/.rvm/gems/ruby-2.3.1/gems/bundler-1.13.7/lib/bundler/runtime.rb:75:in each' /ruby-2.3.1/gems/bundler-1.13.7/lib/bundler/runtime.rb:75:in require'from /home/gaston/.rvm/gems/ruby-2.3.1/gems/bundler-1.13 .7 / lib / bundler.rb:106:in require'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:in require'from /home/gaston/.rvm/gems/ruby-2.3.1/gems/railties-5.1.0/lib/rails/commands/server/server_command . rb:128:在执行中从/home/gaston/.rvm/gems/ruby-2.3.1/gems/railties-5.1.0/lib/rails/commands/server/server_command.rb:125:in tap 'from /home/gaston/.rvm/gems/ruby-2.3.1/gems/railties-5.1.0/lib/rails/commands/server/server_command.rb:125:in perform'from / home / gaston / . rvm / gems / ruby-2.3.1 / gems / thor-0.19.4 / lib / thor / command.rb:27:in run'from /home/gaston/.rvm/gems/ruby-2.3.1/gems/ thor-0.19.4 / lib / thor / invocation.rb:126:在/home/gaston/.rvm/gems/ruby-2.3.1/gems/thor-0.19.4/lib/thor.rb的invoke_command'中: 369:发送'from /home/gaston/.rvm/gems/ruby-2.3.1/gems/railties-5.1.0/lib/rails/command/base.rb:63:in perform'from / home / gaston /.rvm/gems/ruby-2.3.1/gems/railties-5.1.0/lib/ rails / command.rb:44:从/home/gaston/.rvm/gems/ruby-2.3.1/gems/railties-5.1.0/lib/rails/commands.rb:16:in'调用'from / home / gaston / workspace / cloud9workspace / projects / time / bin / rails:9:in require'from / home / gaston / Workspace / cloud9workspace / projects / time / bin / rails:9:in'from / home / gaston / . rvm / gems / ruby-2.3.1 / gems / spring-2.0.2 / lib / spring / client / rails.rb:28:in load'from /home/gaston/.rvm/gems/ruby-2.3.1/ gems / spring-2.0.2 / lib / spring / client / rails.rb:28:in call'from /home/gaston/.rvm/gems/ruby-2.3.1/gems/spring-2.0.2/lib/ spring / client / command.rb:7:in call'from /home/gaston/.rvm/gems/ruby-2.3.1/gems/spring-2.0.2/lib/spring/client.rb:30:in run来自/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:in load'来自/home/gaston/.rvm/gems/ruby-2.3.1/gems/spring-2.0 .2 / lib / spring / binstub.rb:31:在<top(required)>'from / home / gaston / Workspace / cloud9workspace / projects / time / b in / spring:13:in require'from / home / gaston / Workspace / cloud9workspace / projects / time / bin / spring:13:in <top(required)>'from bin / rails:3:inload'from bin / rails :3:在''

这是我的文件: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中,我已经更新到最新版本 . 的Gemfile

gem 'faker', '~> 1.8', '>= 1.8.1'

这是我的application.rb,(前7行)application.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) 
...

1 回答

  • 1

    更新时出现问题 . 我从头开始完成这个过程,现在它可以工作了 . 它与faker无关 .

相关问题