rails`require':无法加载该文件 - 矩阵

发布于 2025-01-23 19:58:55 字数 169 浏览 3 评论 0原文

在更新了Ruby 3.1.2和Rails 7.0.2.3之后,

在开始Rails应用程序时会出现以下错误:

`require': cannot load such file -- matrix (LoadError)

可能是可能的解决方案,谢谢。

after updating to ruby 3.1.2 and Rails 7.0.2.3

getting following error while starting rails application:

`require': cannot load such file -- matrix (LoadError)

what could be the possible solution, thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

御守 2025-01-30 19:58:55

在3.1版中,从Ruby的标准库中删除了矩阵。更多信息: https:/ /www.ruby-lang.org/en/news/2021/12/25/ruby-3-1-0-relase/

使用Ruby 3.1,需要将Matrix明确添加到Gemfile中。您可以手动添加它或运行类似的内容:

$ bundle add matrix

将其添加到Gemfile之后,捆绑您的应用程序:

$ bundle install

然后,您的应用程序应该继续像以前的Ruby版本一样行事。

Matrix was removed from Ruby's standard library in version 3.1. More info: https://www.ruby-lang.org/en/news/2021/12/25/ruby-3-1-0-released/

With Ruby 3.1, matrix needs to be explicitly added to the Gemfile. You can add it manually or run something like:

$ bundle add matrix

After it's added to the Gemfile, bundle your application:

$ bundle install

Then your application should continue to behave like it did in previous Ruby versions.

孤蝉 2025-01-30 19:58:55

同样, Ruby 3.1.2,Rails 7.0.4 在将大虾添加到Gemfile之后。我不得不将gem'matrix'添加到gemfile,并且有效。

same here, ruby 3.1.2, rails 7.0.4 after adding prawn to gemfile. I had to add gem 'matrix' to gemfile and it works.

意中人 2025-01-30 19:58:55

当升级 rails 6--> 7 Ruby 3.0.0-3.1.2 时,我也介绍了这个问题。

就我的情况而言,问题与Capybara Gem有关。版本3.35.3假定它默认使用Ruby安装。
当我将Capybara升级到版本3.37.1时,也会自动安装矩阵GEM,并解决了问题。

I came onto this issue as well when upgrading Rails 6->7 and Ruby 3.0.0->3.1.2.

For my case the issue was related to Capybara gem. Version 3.35.3 assumed it is installed by default with Ruby.
When I upgraded the Capybara to version 3.37.1 then matrix gem was automatically installed as well and the issue was resolved.

ぽ尐不点ル 2025-01-30 19:58:55

在添加 RubyStats GEM中,也使用Ruby 3.1.2和Rails 7.0.4添加 RubyStats GEM,就遇到了同一问题。

@siasmj的修复程序对我有用。

Just ran into the same issue after adding rubystats gem for some seed data, also using ruby 3.1.2 and rails 7.0.4.

@siasmj 's fix worked for me.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文