请帮我解决此错误。
我在Gemfile中添加了“gem 'paperclip', '~> 3.0'
”并运行了命令bundle install
。
安装捆绑后,当我输入"rails g controller user"
并按回车键时,我收到以下错误。
错误:
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包含此代码。
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]
请帮我找出解决方案。提前谢谢。
答案 0 :(得分:0)
只需将其放入您的应用终端:
gem install tzinfo-data
然后将gemfile行更改为:
gem 'tzinfo-data', platforms: [:x64_mingw, :mingw, :mswin]
然后再次在您的终端:
bundle update
这将直接解决问题。