An error occurred while running subprocess cordova

I have recently updated my ionic version, previously the app used to build successfully but now after updating the ionic version i am unable to build the app, i tried downgrading ionic but of no luck, its the same issue with new apps too.
this is the error am facing

cordova build ios
Cannot read property ‘toLowerCase’ of undefined
[ERROR] An error occurred while running subprocess cordova.

    cordova build ios exited with exit code 1.

Any help is appreciated

Two possible causes:

  1. You’re using toLowerCase somewhere instead of toLowerCase()
  2. The variable where you’re using toLowerCase() is undefined (null)

i reckon am not using toLowerCase anywhere !