繁体   English   中英

Rails 服务器失败,因为找不到 tzinfo-data

[英]Rails server failed because tzinfo-data is not found

我在 Windows(x64) 上使用 Ruby 3.1.2,我正在尝试运行 rails 服务器并连接到 localhost:3000。

我在 cmd 中执行rails s (同时指向由rails new创建的文件夹),但消息显示tzinfo-data is not present. Please add gem 'tzinfo-data' to your Gemfile and run bundle install (TZInfo::DataSourceNotFound) tzinfo-data is not present. Please add gem 'tzinfo-data' to your Gemfile and run bundle install (TZInfo::DataSourceNotFound)

然后,我在 .txt 中打开 Gemfile 并写下这一行: gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw]

之后我也会进行bundle install

但是当我再次执行rails server时,它仍然显示相同的消息,说 tzinfo-data 不存在。

图 1

图 2

如果有人能解决我的问题,万分感谢。

Bundler 中有一个错误,这意味着没有与 Windows 上的 64 位 Ruby 3.1 匹配的有效平台值。

使用Gemfile (或任何platforms选项)中gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw] ,Bundler 将从包中排除 tzinfo-data,您将收到TZInfo::DataSourceNotFound错误.

解决方案是从 Gemfile 的 tzinfo-data 行中删除platforms选项,然后运行bundle install

gem 'tzinfo-data'

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM