Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails `require': cannot load such file -- matrix

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.

like image 554
vidur punj Avatar asked Aug 31 '25 14:08

vidur punj


1 Answers

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.

like image 98
siasmj Avatar answered Sep 02 '25 16:09

siasmj