Cannot build ios, error at copy-www-build-step [SOLVED]

Hi,

I Cannot build using the command ionic cordova build ios or build using XCode. It appears like the Cordova’s Copy www directory process got killed’. Noted that I tested this on fresh ionic template without doing anything fancy.

Here is the error

PhaseScriptExecution Copy\ www\ directory /Users/tonsu/Library/Developer/Xcode/DerivedData/MyApp-guoiiessxhrkleexghgevznwdrwo/Build/Intermediates/MyApp.build/Debug-iphonesimulator/MyApp.build/Script-304B58A110DAC018002A0835.sh
    cd /Users/tonsu/Dev/Ionic/IonicExample/platforms/ios
    /bin/sh -c /Users/tonsu/Library/Developer/Xcode/DerivedData/MyApp-guoiiessxhrkleexghgevznwdrwo/Build/Intermediates/MyApp.build/Debug-iphonesimulator/MyApp.build/Script-304B58A110DAC018002A0835.sh
/Users/tonsu/Library/Developer/Xcode/DerivedData/MyApp-guoiiessxhrkleexghgevznwdrwo/Build/Intermediates/MyApp.build/Debug-iphonesimulator/MyApp.build/Script-304B58A110DAC018002A0835.sh: line 2:  1116 Killed: 9               node cordova/lib/copy-www-build-step.js
Command /bin/sh failed with exit code 137

Other information:
I tried re-installing Ionic, Cordova, Xcode, Node and even downgraded Cordova and Node but I still got the same error. It’s was fine before I re-install my mac.

Ionic info:

cli packages: (/Users/tonsu/.nvm/versions/node/v8.4.0/lib/node_modules)

    @ionic/cli-utils  : 1.9.2
    ionic (Ionic CLI) : 3.9.2

global packages:

    Cordova CLI : 7.0.1 

local packages:

    @ionic/app-scripts : 2.1.3
    Cordova Platforms  : ios 4.4.0
    Ionic Framework    : ionic-angular 3.6.0

System:

    Android SDK Tools : 26.0.2
    ios-deploy        : 2.0.0 
    Node              : v8.4.0
    npm               : 5.3.0 
    OS                : macOS Sierra
    Xcode             : Xcode 8.3.3 Build version 8E3004b 

Any help is be much appreciated. Thank you.

I think this error is very rare so the only solution is reinstalling entire OSX and the error is now gone.

How do you solved? your post says its solved, thank you.