Remco Haszing created CB-12816:
----------------------------------

             Summary: Cordova platform add fails when using the npm that comes 
with cordova-lib
                 Key: CB-12816
                 URL: https://issues.apache.org/jira/browse/CB-12816
             Project: Apache Cordova
          Issue Type: Bug
          Components: cordova-fetch, cordova-lib
    Affects Versions: 7.0.0
         Environment: Tested in Ubuntu 17.04 and OS X.
            Reporter: Remco Haszing


When the npm version that is bundled with Cordova (2.15.12) is in {{PATH}}, 
adding Cordova platforms fail.

I tried to reproduce this, but I accidentally triggered a slightly different 
error message than intended.

{code}
$ cordova create example
Creating a new cordova project.
$ cd example/
$ npm init
This utility will walk you through creating a package.json file.
It only covers the most common items, and tries to guess sensible defaults.

See `npm help json` for definitive documentation on these fields
and exactly what they do.

Use `npm install <pkg> --save` afterwards to install a package and
save it as a dependency in the package.json file.

Press ^C at any time to quit.
name: (helloworld) 
version: (1.0.0) 
git repository: 
keywords: 
license: (Apache-2.0) 
About to write to /tmp/example/package.json:

{
  "name": "helloworld",
  "displayName": "HelloCordova",
  "version": "1.0.0",
  "description": "A sample Apache Cordova application that responds to the 
deviceready event.",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "Apache Cordova Team",
  "license": "Apache-2.0"
}


Is this ok? (yes)
$ npm install cordova
... [TRUNCATED] ...
$ PATH="$(npm bin):$PATH" cordova platform add android
Using cordova-fetch for cordova-android@~6.2.2
Adding xmldom project...
Error: Your xmldom platform does not have Api.js
{code}

In the above example, cordova is installed in the same directory as where 
cordova-fetch stores them. The error I originally encountered, can be triggered 
using the following commands:

{code}
$ rm -r platforms/ plugins/ node_modules/
$ PATH="$(npm -g prefix)/lib/node_modules/cordova/bin:$PATH" cordova platform 
add android
Using cordova-fetch for cordova-android@^6.2.3
Error: Platform android already added.
{code}

The example shows the error for the android platform, but the same error occurs 
when using cordova-ios.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to