Solved BUILD FAILED sudo npm install -g ios-deploy

Apache Cordova iOS Deploy

Installing ios-deploy plugin for Apache Cordova fails if you are running OS X 10.11 El Capitan or greater. You can see the following lines in the command line which says:

error: Unable to create directory: /usr/local/lib/node_modules/ios-deploy/build (Permission denied)
error: Unable to create directory: /usr/local/lib/node_modules/ios-deploy/build (Permission denied)

You can also the following warning:

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!! WARNING: You are on OS X 10.11 El Capitan or greater, you may need to add the
!!!! WARNING: --unsafe-perm=true flag when running npm install
!!!! WARNING: or else it will fail.
!!!! WARNING: link:
!!!! WARNING: https://github.com/phonegap/ios-deploy#os-x-1011-el-capitan

Follow the instruction in the warning to have a successful installation. I use the following line to allow unsafe installation.

sudo npm install --global --unsafe-perm ios-deploy