Error Regarding undefined method `map' for nil:NilClass for Flutter App / CocoaPod Error

9,802

Solution 1

Are you using Apple M1? I had this issue as well and after some research I find that it might be something to do with Rosetta. You can refer to Running CocoaPods on Apple Silicon (M1).

I managed to solve this issue on my MacBook Air M1 by typing this in the terminal:

sudo arch -x86_64 gem install ffi

from here https://stackoverflow.com/a/65334677/13814270.

Solution 2

I was trying to run pod install command in ios folder. @boonyongyang solution is necessary but it seemed that I had 2 ffi's installed, so I had to also run it with arch -x86_64 command

sudo arch -x86_64 gem install ffi
# go to ios folder then run
arch -x86_64 pod install
Share:
9,802
Samarth Shah
Author by

Samarth Shah

Samarth Shah= I do android programming or otherwise known as XML, and am learning the Java in it know.

Updated on December 29, 2022

Comments

  • Samarth Shah
    Samarth Shah over 1 year

    I'm having an error regarding my Flutter application. When I run the "flutter run" script in terminal, I'm getting the following error from Cocoapods: "Error output from CocoaPods: Searching for inspections failed: undefined method `map' for nil:NilClass" (as seen also by the attached picture). enter image description here

    How do I go about solving this issue?

  • Haseeb Burki
    Haseeb Burki almost 3 years
    Is there any diff b/w running this command and changing the terminal option to "open with rosetta" fix?
  • Dohan Smit
    Dohan Smit over 2 years
    This helped a lot..Thank you
  • Sharjeel Ali
    Sharjeel Ali over 2 years
    This is happening when I started flutter development in MacBook M1. On my old MacBook, it was normal and working fine. Does anyone know the reason?
  • Royalty
    Royalty over 2 years
    Thanks helped me too :)
  • famfamfam
    famfamfam about 2 years
    hi, please help my problem : stackoverflow.com/questions/71866620/…
  • Lalit Fauzdar
    Lalit Fauzdar almost 2 years
    I've installed this multiple times, not working.
  • efesahin
    efesahin almost 2 years
    works for apple MacBook Pro m1 <3
  • Daniel
    Daniel almost 2 years
    works for Apple Macbook Air M1 aswell. I had to do that everytime I installed a new Firebase plugin.
  • Felix Mittermeier
    Felix Mittermeier almost 2 years
    Good answer but it might be good to mention that you have to run all suggested fixes from flutter also with this new prefix. For example: "pod update Firebase/Messaging" -> "arch -x86_64 pod update Firebase/Messaging"