在官网上学习rails 4.1 ,启动rails server之后发生了如下错误
$ rails server
Booting WEBrick
Rails 4.1.0 application starting in development on ....
Exiting
c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/tzinfo-1.1.0/lib/tzinfo/data_source.rb:199:
in `rescue in create_default_data_source':
No timezone data source could be found. To resolve this, either install
TZInfo::Data (e.g. by running `gem install tzinfo-data`) or specify a zoneinfo
directory using `TZInfo::DataSource.set(:zoneinfo, zoneinfo_path)`.
(TZInfo::DataSourceNotFound)
from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/tzinfo-1.1.0/lib/tzinfo/data_source.rb:196:
in `create_default_data_source'
给出了解决方法,安装tzinfo-data,在运行命令gem install tzinfo-data之后,还是这个错误。
原因是因为64位操作系统,打开创建的rails应用下的gemfile文件,
找到gem 'tzinfo-data', platforms: [:mingw, :mswin]
改为gem 'tzinfo-data', platforms: [:mingw, :mswin , :x64_mingw],
然后运行bundle update,即可。
参考:http://stackoverflow.com/questions/23022258/tzinfodatasourcenotfound-error-starting-rails-v4-1-0-server-on-windows