Error: variables.forEach is not a function while ionic build ios

ionic cordova build ios --release --prod

cordova platform add --save ios
:heavy_multiplication_x: Running command - failed!
[ERROR] An error occurred while running cordova platform add --save ios (exit code 1):

    Using cordova-fetch for cordova-ios@^4.4.0
    Adding ios project...
    Creating Cordova project for the iOS platform:
    Path: platforms/ios
    Package: com.myproject.example
    Name: example
    iOS project created with cordova-ios@4.4.0
    Installing "cordova-clipboard" for ios
    Installing "cordova-plugin-x-socialsharing" for ios
    Installing "es6-promise-plugin" for ios
    Error: variables.forEach is not a function

i have no idea why this occurs, can anyone help

Hey,

i had this problem today.
The problem was that there was a plugin defined in the package.json, that was not in the config.xml. I re-added the plugin through ionic cordova plugin add ___ , and the problem was solved

Greetings,
Kriz

3 Likes

Thanks for your reply @KrizRoring actually I solved my issue by entirely changing my package.json

I just cleaned “plugins” array inside “cordova” array in package.json and that did the trick.

4 Likes

Thanks it’s working fine perfectly