Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-13937

`cordova platform add ios` fails if `ios` folder is present

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 8.0.0
    • None
    • cordova-lib
    • None

    Description

      If there is a folder called like the platform you want to install, it will fail.

      See here for an example where an `ios` folder was present before executing `cordova platform add ios`:

      ```
      MacBook-Pro:project sujan$ cordova platform add ios
      (node:3439) UnhandledPromiseRejectionWarning: CordovaError: Error: npm: Command failed with exit code 1 Error output:
      npm ERR! code ENOLOCAL
      npm ERR! Could not install from "ios" as it does not contain a package.json file.
      
      npm ERR! A complete log of this run can be found in:
      npm ERR!     /Users/sujan/.npm/_logs/2018-03-01T19_56_48_106Z-debug.log
          at /Users/sujan/.nvm/versions/node/v9.4.0/lib/node_modules/cordova/node_modules/cordova-fetch/index.js:104:29
          at _rejected (/Users/sujan/.nvm/versions/node/v9.4.0/lib/node_modules/cordova/node_modules/q/q.js:864:24)
          at /Users/sujan/.nvm/versions/node/v9.4.0/lib/node_modules/cordova/node_modules/q/q.js:890:30
          at Promise.when (/Users/sujan/.nvm/versions/node/v9.4.0/lib/node_modules/cordova/node_modules/q/q.js:1142:31)
          at Promise.promise.promiseDispatch (/Users/sujan/.nvm/versions/node/v9.4.0/lib/node_modules/cordova/node_modules/q/q.js:808:41)
          at /Users/sujan/.nvm/versions/node/v9.4.0/lib/node_modules/cordova/node_modules/q/q.js:624:44
          at runSingle (/Users/sujan/.nvm/versions/node/v9.4.0/lib/node_modules/cordova/node_modules/q/q.js:137:13)
          at flush (/Users/sujan/.nvm/versions/node/v9.4.0/lib/node_modules/cordova/node_modules/q/q.js:125:13)
          at process._tickCallback (internal/process/next_tick.js:150:11)
      (node:3439) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
      (node:3439) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
      

      When renaming the `ios` folder to `_ios` it all works as expected:

      MacBook-Pro:project sujan$ cordova platform add ios
      Using cordova-fetch for cordova-ios@~4.5.4
      Adding ios project...
      Creating Cordova project for the iOS platform:
      	Path: platforms/ios
      ...
      

      Is this expected behavior?
      Is there a simple way to work around this without removing or renaming the folder?

      Attachments

        Activity

          People

            Unassigned Unassigned
            Sujan12 Jan Piotrowski (janpio)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: