Flutter fire exception: cannot load such file — xcodeproj

  Kiến thức lập trình

I encountered this error today when trying to run the command flutterfire configure --project=<project> for my Flutter project.

i Found 13 Firebase projects. Selecting project <project>.                                                                                                                                                              
✔ Which platforms should your configuration support (use arrow keys & space to select)? · android, ios                                                                                                                        
i Firebase android app <package_name> registered.                                                                                                                                                                               
i Firebase ios app <package_name> registered.                                                                                                                                                                                   
Exception: /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- xcodeproj (LoadError)
        from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
        from -e:1:in `<main>'

I also tried running the command sudo gem install xcodeproj to install xcodeproj, but I received an error:

ERROR:  Could not find a valid gem 'xcodeproj' (>= 0) in any repository

How can I fix it? Thanks!