Ionic fails building in macos 12 (Monterey)

ionic gives me error when i did try to build and add android platform to project in macos 12 as below image. even i had the same issue when try to check cordova version in terminal

The solution is remove cordova and add it again

1- sudo npm uninstall -g cordova
and then install it again which version you prefer, it was cordova@10.0.0 for me so 
2- sudo npm install -g cordova@10.0.0

This will fix your issue, i hope it will help