首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >rails-4中的TZInfo::DataSourceNotFound

rails-4中的TZInfo::DataSourceNotFound
EN

Stack Overflow用户
提问于 2014-12-19 18:29:09
回答 1查看 711关注 0票数 0

请帮助我解决此错误。

我在Gemfile中添加了"gem 'paperclip', '~> 3.0'“并运行命令bundle install

安装捆绑包后,当我键入"rails g controller user"并按enter键时,我收到以下错误。

错误:

代码语言:javascript
复制
C:/Ruby193/lib/ruby/gems/1.9.1/gems/tzinfo-1.2.2/lib/tzinfo/data_source.rb:182:i
n `rescue in create_default_data_source': No source of timezone data could be fo
und. (TZInfo::DataSourceNotFound)
Please refer to http://tzinfo.github.io/datasourcenotfound for help resolving th
is error.
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/tzinfo-1.2.2/lib/tzinfo/data_so
urce.rb:179:in `create_default_data_source'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/tzinfo-1.2.2/lib/tzinfo/data_so
urce.rb:40:in `block in get'
        from <internal:prelude>:10:in `synchronize'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/tzinfo-1.2.2/lib/tzinfo/data_so
urce.rb:39:in `get'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/tzinfo-1.2.2/lib/tzinfo/timezon
e.rb:629:in `data_source'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/tzinfo-1.2.2/lib/tzinfo/timezon
e.rb:92:in `get'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/tzinfo-1.2.2/lib/tzinfo/timezon
e_proxy.rb:67:in `real_timezone'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/tzinfo-1.2.2/lib/tzinfo/timezon
e_proxy.rb:30:in `period_for_utc'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/tzinfo-1.2.2/lib/tzinfo/timezon
e.rb:549:in `current_period'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-4.1.7/lib/active_
support/core_ext/object/try.rb:45:in `public_send'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-4.1.7/lib/active_
support/core_ext/object/try.rb:45:in `try'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-4.1.7/lib/active_
support/values/time_zone.rb:223:in `utc_offset'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-4.1.7/lib/active_
support/values/time_zone.rb:396:in `block in []'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-4.1.7/lib/active_
support/values/time_zone.rb:396:in `tap'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-4.1.7/lib/active_
support/values/time_zone.rb:396:in `[]'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-4.1.7/lib/active_
support/core_ext/time/zones.rb:60:in `find_zone!'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-4.1.7/lib/active_
support/railtie.rb:20:in `block in <class:Railtie>'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-4.1.7/lib/rails/initia
lizable.rb:30:in `instance_exec'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-4.1.7/lib/rails/initia
lizable.rb:30:in `run'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-4.1.7/lib/rails/initia
lizable.rb:55:in `block in run_initializers'
        from C:/Ruby193/lib/ruby/1.9.1/tsort.rb:150:in `block in tsort_each'
        from C:/Ruby193/lib/ruby/1.9.1/tsort.rb:183:in `block (2 levels) in each
_strongly_connected_component'
        from C:/Ruby193/lib/ruby/1.9.1/tsort.rb:219:in `each_strongly_connected_
component_from'
        from C:/Ruby193/lib/ruby/1.9.1/tsort.rb:182:in `block in each_strongly_c
onnected_component'
        from C:/Ruby193/lib/ruby/1.9.1/tsort.rb:180:in `each'
        from C:/Ruby193/lib/ruby/1.9.1/tsort.rb:180:in `each_strongly_connected_
component'
        from C:/Ruby193/lib/ruby/1.9.1/tsort.rb:148:in `tsort_each'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-4.1.7/lib/rails/initia
lizable.rb:54:in `run_initializers'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-4.1.7/lib/rails/applic
ation.rb:300:in `initialize!'
        from c:/Site/attachment/config/environment.rb:5:in `<top (required)>'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-4.1.7/lib/rails/applic
ation.rb:276:in `require'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-4.1.7/lib/rails/applic
ation.rb:276:in `require_environment!'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-4.1.7/lib/rails/comman
ds/commands_tasks.rb:147:in `require_application_and_environment!'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-4.1.7/lib/rails/comman
ds/commands_tasks.rb:133:in `generate_or_destroy'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-4.1.7/lib/rails/comman
ds/commands_tasks.rb:51:in `generate'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-4.1.7/lib/rails/comman
ds/commands_tasks.rb:40:in `run_command!'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-4.1.7/lib/rails/comman
ds.rb:17:in `<top (required)>'
        from bin/rails:4:in `require'
        from bin/rails:4:in `<main>'

我的Gemfile包含以下代码。

代码语言:javascript
复制
source 'https://rubygems.org'


# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.7'

# Use sqlite3 as the database for Active Record
gem 'sqlite3'

# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.3'

# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'

# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'

# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'

# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'

# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 1.2'

group :doc do
  # bundle exec rake doc:rails generates the API under doc/api.
  gem 'sdoc', require: false
end

# Paperclip gem for managing file uploads
gem 'paperclip', '~> 3.0'

# Use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

# Use unicorn as the app server
# gem 'unicorn'

# Use Capistrano for deployment
# gem 'capistrano', group: :development

# Use debugger
# gem 'debugger', group: [:development, :test]

请帮我找出解决方案。提前谢谢。

EN

回答 1

Stack Overflow用户

发布于 2014-12-19 18:49:50

只需将此代码放入您的应用程序终端:

代码语言:javascript
复制
gem install tzinfo-data

然后将gemfile行更改为:

代码语言:javascript
复制
gem 'tzinfo-data', platforms: [:x64_mingw, :mingw, :mswin]

然后再次在您的终端中:

代码语言:javascript
复制
bundle update

这将直接解决问题。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/27564076

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档