title: Unable to compile Phonegap app locally
body: <p>I'm unable to compile my app for iOS locally, Android works OK.</p>
  
  <p>I have installed both <code>cordova</code> and <code>phonegap</code> using <code>npm install -g [...]</code>.  I am running OSX (10.7.5).</p>
  
  <p>Version outputs from both:</p>
  
  <pre><code>$ cordova -v
  5.1.1
  $ phonegap -v
  0.9.4
  </code></pre>
  
  <p>I have XCode installed (v 4.6.2).  I also have the command-line tools installed.</p>
  
  <p>Both the cordova and phonegap tools fail to build, seemingly for the same reason.  Running <code>phonegap build ios</code> outputs:</p>
  
  <pre><code>$ phonegap build ios
    phonegap  detecting iOS SDK environment...
    phonegap  using the local environment
    phonegap  compiling iOS...
       error  ENOENT, no such file or directory '/Users/mike/apps/***/platforms/ios/__CLI__/config.xml'
  </code></pre>
  
  <p>Here is the output from the same <code>cordova</code> command:</p>
  
  <pre><code>$ cordova build ios
  cp: copyFileSync: could not write to dest file (code=ENOENT):/Users/mike/apps/***/platforms/ios/__CLI__/config.xml
  
  cp: no such file or directory: /Users/mike/apps/***/platforms/ios/platform_www/*
  
  Parsing /Users/mike/apps/***/platforms/ios/__CLI__/config.xml failed
  Error: ENOENT, no such file or directory '/Users/mike/apps/***/platforms/ios/__CLI__/config.xml'
      at Error (native)
      at Object.fs.openSync (fs.js:500:18)
      at Object.fs.readFileSync (fs.js:352:15)
      at Object.module.exports.parseElementtreeSync (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/util/xml-helpers.js:118:27)
      at Object.ConfigParser (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/configparser/ConfigParser.js:33:24)
      at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/prepare.js:115:32
      at Array.map (native)
      at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/prepare.js:70:40
      at _fulfilled (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:787:54)
      at self.promiseDispatch.done (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:816:30)
  </code></pre>
  
  <p>It seems to me that there should be some replacement running on <code>__CLI__</code> in the path that isn't happening, but it's difficult to tell. Below is a screenshot of the file structure this generates:</p>
  
  <p><img src="https://i.stack.imgur.com/djUKt.png" alt="FileStructure"> </p>
  
  <p>I am able to build using the remote build service, but it's quite laborious, as the app isn't properly loading so I need to do quite a bit of debugging to sort this out.</p>
  
  <p>Node is installed at version 0.12.5.  NPM is installed at version 2.11.2.</p>
  
  <p>I have reinstalled the platform numerous times, and always get this error.</p>