You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Jan Piotrowski (Sujan) (JIRA)" <ji...@apache.org> on 2018/03/01 20:19:00 UTC

[jira] [Updated] (CB-13937) `cordova platform add ios` fails if `ios` folder is present

     [ https://issues.apache.org/jira/browse/CB-13937?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jan Piotrowski (Sujan) updated CB-13937:
----------------------------------------
    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`:

{code}
```
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.
{code}

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

{code}
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
...
{code}

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

  was:
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`:

{code}
```
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.
{code}

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

{code}
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
...
{code}

Is this expected behaviour?


> `cordova platform add ios` fails if `ios` folder is present
> -----------------------------------------------------------
>
>                 Key: CB-13937
>                 URL: https://issues.apache.org/jira/browse/CB-13937
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: cordova-cli, cordova-fetch
>    Affects Versions: 8.0.0
>            Reporter: Jan Piotrowski (Sujan)
>            Priority: Major
>
> 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`:
> {code}
> ```
> 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.
> {code}
> When renaming the `ios` folder to `_ios` it all works as expected:
> {code}
> 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
> ...
> {code}
> Is this expected behavior?
> Is there a simple way to work around this without removing or renaming the folder?



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org