由于 tzinfo 错误,无法执行 bundle exec rake db:migrate [英] Can't execute bundle exec rake db:migrate due to tzinfo error

查看:76
本文介绍了由于 tzinfo 错误,无法执行 bundle exec rake db:migrate的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如标题所述.我得到了

C:\...>bundle exec rake db:migrate
rake aborted!
LoadError: cannot load such file -- tzinfo
C:/.../config/application.rb:3:in `require'
C:/.../config/application.rb:3:in `<top (required
)>'
C:/.../Rakefile:4:in `require'
C:/.../Rakefile:4:in `<top (required)>'
(See full trace by running task with --trace)

我的 rails 是 v4.2.2,我的 ruby​​ 是 Windows 8(64 位)上的 v2.2.根据我遇到的各种 SO 问题,由于特定 gem 之间的某些不兼容,我可能会收到此错误.因此,这是我的 gemfile,其中包含一些已经尝试过的选项.

My rails are v4.2.2 and my ruby is v2.2 on Windows 8 (64bit). According to various SO questions I went through I might get this error due to some incompatiblities between the specific gems. Hence here's my gemfile with some options already tried out.

source 'https://rubygems.org'

gem 'rails',        '4.2.2'
gem 'sass-rails',   '5.0.2'
gem 'uglifier',     '2.5.3'
gem 'coffee-rails', '4.1.0'
gem 'jquery-rails', '4.0.3'
gem 'turbolinks',   '2.3.0'
gem 'jbuilder',     '2.2.3'
gem 'sdoc',         '0.4.0', group: :doc
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw]
#gem 'tzinfo',       '1.2.2'

group :development, :test do
  gem 'sqlite3',     '1.3.9'
  gem 'byebug',      '3.4.0'
  #gem 'web-console', '2.0.0.beta3'
  gem 'spring',      '1.1.3'
end

group :production do
  gem 'pg',             '0.17.1'
  gem 'rails_12factor', '0.0.2'
end

有什么线索吗?

更新

我的 gemfile.lock

My gemfile.lock

GEM
  remote: https://rubygems.org/
  specs:
    actionmailer (4.2.2)
      actionpack (= 4.2.2)
      actionview (= 4.2.2)
      activejob (= 4.2.2)
      mail (~> 2.5, >= 2.5.4)
      rails-dom-testing (~> 1.0, >= 1.0.5)
    actionpack (4.2.2)
      actionview (= 4.2.2)
      activesupport (= 4.2.2)
      rack (~> 1.6)
      rack-test (~> 0.6.2)
      rails-dom-testing (~> 1.0, >= 1.0.5)
      rails-html-sanitizer (~> 1.0, >= 1.0.1)
    actionview (4.2.2)
      activesupport (= 4.2.2)
      builder (~> 3.1)
      erubis (~> 2.7.0)
      rails-dom-testing (~> 1.0, >= 1.0.5)
      rails-html-sanitizer (~> 1.0, >= 1.0.1)
    activejob (4.2.2)
      activesupport (= 4.2.2)
      globalid (>= 0.3.0)
    activemodel (4.2.2)
      activesupport (= 4.2.2)
      builder (~> 3.1)
    activerecord (4.2.2)
      activemodel (= 4.2.2)
      activesupport (= 4.2.2)
      arel (~> 6.0)
    activesupport (4.2.2)
      i18n (~> 0.7)
      json (~> 1.7, >= 1.7.7)
      minitest (~> 5.1)
      thread_safe (~> 0.3, >= 0.3.4)
      tzinfo (~> 1.1)
    arel (6.0.3)
    builder (3.2.2)
    byebug (3.4.0)
      columnize (~> 0.8)
      debugger-linecache (~> 1.2)
      slop (~> 3.6)
    coffee-rails (4.1.0)
      coffee-script (>= 2.2.0)
      railties (>= 4.0.0, < 5.0)
    coffee-script (2.4.1)
      coffee-script-source
      execjs
    coffee-script-source (1.10.0)
    columnize (0.9.0)
    concurrent-ruby (1.0.1)
    debugger-linecache (1.2.0)
    erubis (2.7.0)
    execjs (2.6.0)
    globalid (0.3.6)
      activesupport (>= 4.1.0)
    i18n (0.7.0)
    jbuilder (2.2.3)
      activesupport (>= 3.0.0, < 5)
      multi_json (~> 1.2)
    jquery-rails (4.0.3)
      rails-dom-testing (~> 1.0)
      railties (>= 4.2.0)
      thor (>= 0.14, < 2.0)
    json (1.8.3)
    loofah (2.0.3)
      nokogiri (>= 1.5.9)
    mail (2.6.4)
      mime-types (>= 1.16, < 4)
    mime-types (3.0)
      mime-types-data (~> 3.2015)
    mime-types-data (3.2016.0221)
    mini_portile2 (2.0.0)
    minitest (5.8.4)
    multi_json (1.11.2)
    nokogiri (1.6.7.2-x86-mingw32)
      mini_portile2 (~> 2.0.0.rc2)
    pg (0.17.1-x86-mingw32)
    rack (1.6.4)
    rack-test (0.6.3)
      rack (>= 1.0)
    rails (4.2.2)
      actionmailer (= 4.2.2)
      actionpack (= 4.2.2)
      actionview (= 4.2.2)
      activejob (= 4.2.2)
      activemodel (= 4.2.2)
      activerecord (= 4.2.2)
      activesupport (= 4.2.2)
      bundler (>= 1.3.0, < 2.0)
      railties (= 4.2.2)
      sprockets-rails
    rails-deprecated_sanitizer (1.0.3)
      activesupport (>= 4.2.0.alpha)
    rails-dom-testing (1.0.7)
      activesupport (>= 4.2.0.beta, < 5.0)
      nokogiri (~> 1.6.0)
      rails-deprecated_sanitizer (>= 1.0.1)
    rails-html-sanitizer (1.0.3)
      loofah (~> 2.0)
    rails_12factor (0.0.2)
      rails_serve_static_assets
      rails_stdout_logging
    rails_serve_static_assets (0.0.5)
    rails_stdout_logging (0.0.5)
    railties (4.2.2)
      actionpack (= 4.2.2)
      activesupport (= 4.2.2)
      rake (>= 0.8.7)
      thor (>= 0.18.1, < 2.0)
    rake (11.1.2)
    rdoc (4.2.2)
      json (~> 1.4)
    sass (3.4.22)
    sass-rails (5.0.2)
      railties (>= 4.0.0, < 5.0)
      sass (~> 3.1)
      sprockets (>= 2.8, < 4.0)
      sprockets-rails (>= 2.0, < 4.0)
      tilt (~> 1.1)
    sdoc (0.4.0)
      json (~> 1.8)
      rdoc (~> 4.0, < 5.0)
    slop (3.6.0)
    spring (1.1.3)
    sprockets (3.6.0)
      concurrent-ruby (~> 1.0)
      rack (> 1, < 3)
    sprockets-rails (3.0.4)
      actionpack (>= 4.0)
      activesupport (>= 4.0)
      sprockets (>= 3.0.0)
    sqlite3 (1.3.9-x86-mingw32)
    thor (0.19.1)
    thread_safe (0.3.5)
    tilt (1.4.1)
    turbolinks (2.3.0)
      coffee-rails
    tzinfo (1.2.2)
      thread_safe (~> 0.1)
    tzinfo-data (1.2016.3)
      tzinfo (>= 1.0.0)
    uglifier (2.5.3)
      execjs (>= 0.3.0)
      json (>= 1.8.0)

PLATFORMS
  x86-mingw32

DEPENDENCIES
  byebug (= 3.4.0)
  coffee-rails (= 4.1.0)
  jbuilder (= 2.2.3)
  jquery-rails (= 4.0.3)
  pg (= 0.17.1)
  rails (= 4.2.2)
  rails_12factor (= 0.0.2)
  sass-rails (= 5.0.2)
  sdoc (= 0.4.0)
  spring (= 1.1.3)
  sqlite3 (= 1.3.9)
  turbolinks (= 2.3.0)
  tzinfo-data
  uglifier (= 2.5.3)

推荐答案

感谢大家的建议,对我帮助很大.解决我的问题的正确方法是:

Thanks for the suggestions guys, it helped me a lot. The proper to solution to my problem was:

  • 删除 gemfile.lock
  • 将 tzinfo 版本降低到 1.2.1,并保留 tzinfo-data 原样来自用户 3097405.
  • 然后发生了另一个错误,所以我不得不将 sqlite3 版本增加到1.3.11.事实证明,我可以取消对 webconsle 的评论.

所以,最后 Gemfile 是这样的

So, in the end the Gemfile looks like this

source 'https://rubygems.org'

gem 'rails',        '4.2.2'
gem 'sass-rails',   '5.0.2'
gem 'uglifier',     '2.5.3'
gem 'coffee-rails', '4.1.0'
gem 'jquery-rails', '4.0.3'
gem 'turbolinks',   '2.3.0'
gem 'jbuilder',     '2.2.3'
gem 'sdoc',         '0.4.0', group: :doc
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw]
gem 'tzinfo',       '1.2.1'

group :development, :test do
  gem 'sqlite3',     '1.3.11'
  gem 'byebug',      '3.4.0'
  gem 'web-console', '2.0.0.beta3'
  gem 'spring',      '1.1.3'
end

group :production do
  gem 'pg',             '0.17.1'
  gem 'rails_12factor', '0.0.2'
end

再一次bundle install后,rake 命令正确执行.

And after one more bundle install the rake command executed properly.

这篇关于由于 tzinfo 错误,无法执行 bundle exec rake db:migrate的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆