Error while adding platform to Cordova App in Eclipse

A. Sinha

After creating a new Cordova project in Eclipse (Mars) when I click Finish, it starts adding platform to my app but ends up throwing the following error and the platform is not added:

X:\CordovaWorkspace\DemoProject>cordova prepare Discovered platform
"[email protected]" in config.xml. Adding it to
the project Adding android project... Running command: cmd "/s /c
"C:\Users\XYZ\.cordova\lib\android\cordova\5.3.0-nightly.2016.7.6.103e1e8d\bin\create.bat

X:\CordovaWorkspace\DemoProject\platforms\android demo.project "Demo
Project" --cli"" module.js:327
    throw err;
     ^

 Error: Cannot find module 'sax'
      at Function.Module._resolveFilename (module.js:325:15)
      at Function.Module._load (module.js:276:25)
      at Module.require (module.js:353:17)
      at require (internal/module.js:12:17)
      at Object.<anonymous> (C:\Users\XYZ\.cordova\lib\android\cordova\5.3.0-nightly.2016.7.6.103e1e8d\node_modules\elementtree\lib\parsers\sax.js:3:11)
      at Module._compile (module.js:409:26)
      at Object.Module._extensions..js (module.js:416:10)
 at Module.load (module.js:343:32)
 at Function.Module._load (module.js:300:12)
 at Module.require (module.js:353:17) Error: cmd: Command failed with exit code 1 Error: No platforms added to this project. Please use
 `cordova platform add <platform>`.

 X:\CordovaWorkspace\DemoProject>exit

enter image description here

How can it be resolved.

Simo

try to manually resolve the sax requirement by downloading the sax module and placing it in a folder called sax.

or use npm install in case you don't find the sax mmodule in the internet you can create sax.js in your node-elementtree/lib/parsers/sax.js and put this code below:

var util = require('util');

var sax = require('sax');

var TreeBuilder = require('./../treebuilder').TreeBuilder;

function XMLParser(target) {
  this.parser = sax.parser(true);

  this.target = (target) ? target : new TreeBuilder();

  this.parser.onopentag = this._handleOpenTag.bind(this);
  this.parser.ontext = this._handleText.bind(this);
  this.parser.oncdata = this._handleCdata.bind(this);
  this.parser.ondoctype = this._handleDoctype.bind(this);
  this.parser.oncomment = this._handleComment.bind(this);
  this.parser.onclosetag = this._handleCloseTag.bind(this);
  this.parser.onerror = this._handleError.bind(this);
}

XMLParser.prototype._handleOpenTag = function(tag) {
  this.target.start(tag.name, tag.attributes);
};

XMLParser.prototype._handleText = function(text) {
  this.target.data(text);
};

XMLParser.prototype._handleCdata = function(text) {
  this.target.data(text);
};

XMLParser.prototype._handleDoctype = function(text) {
};

XMLParser.prototype._handleComment = function(comment) {
};

XMLParser.prototype._handleCloseTag = function(tag) {
  this.target.end(tag);
};

XMLParser.prototype._handleError = function(err) {
  throw err;
};

XMLParser.prototype.feed = function(chunk) {
  this.parser.write(chunk);
};

XMLParser.prototype.close = function() {
  this.parser.close();
  return this.target.close();
};

exports.XMLParser = XMLParser;

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Error while adding platform to Cordova App in Eclipse

From Dev

Error while adding android platform for cordova

From Dev

Cordova, getting Error while adding android platform on Ubuntu 14.04

From Dev

Cordova: Error adding android platform

From Dev

Error while Cordova Run Android Platform

From Dev

Error while building cordova app

From Dev

Problems while adding platforms in Cordova/PhoneGap app?

From Dev

Cordova CLI:an error while adding Android

From Dev

Cordova : Error When adding platform (cannot call method 'replace' of undefined)

From Dev

Error while adding glassfish tools with eclipse

From Dev

Cordova : Error when building Ionic1 app to iOS platform

From Dev

Error while adding phone gap platform with Xcode 6.0-beta

From Dev

Error while Adding Android Platform in Ionic framework in ubuntu

From Dev

Error while adding phone gap platform with Xcode 6.0-beta

From Dev

Error While Adding Cordova Plugin "sqlite-connector.jar" not found!"

From Dev

Error While Adding Cordova Plugin "sqlite-connector.jar" not found!"

From Dev

Error while adding Pushe cordova plugin to Intel® XDK project

From Dev

"Resource is out of Sync" error while generating target Platform in Eclipse

From Dev

Adding blackberry10 platform in cordova(3.0.0) is showing "Error: node cannot be found on the path. Aborting"

From Dev

Why is PhoneGap/Cordova not adding android platform?

From Dev

Error: cordova platform add android

From Dev

Cordova add platform android error

From Dev

Cordova add platform error in Ubuntu

From Dev

Android Studio 1.1.0 - Error while adding Fabric Crashlytics to app

From Dev

Getting Error while adding pubcenter ads in Metro App

From Dev

Error while adding username to my rails web app(devise gem)

From Dev

Exception while building android platform with cordova

From Dev

Exception while building android platform with cordova

From Dev

Cordova version error while using ionic to create new app although cordova is latest

Related Related

  1. 1

    Error while adding platform to Cordova App in Eclipse

  2. 2

    Error while adding android platform for cordova

  3. 3

    Cordova, getting Error while adding android platform on Ubuntu 14.04

  4. 4

    Cordova: Error adding android platform

  5. 5

    Error while Cordova Run Android Platform

  6. 6

    Error while building cordova app

  7. 7

    Problems while adding platforms in Cordova/PhoneGap app?

  8. 8

    Cordova CLI:an error while adding Android

  9. 9

    Cordova : Error When adding platform (cannot call method 'replace' of undefined)

  10. 10

    Error while adding glassfish tools with eclipse

  11. 11

    Cordova : Error when building Ionic1 app to iOS platform

  12. 12

    Error while adding phone gap platform with Xcode 6.0-beta

  13. 13

    Error while Adding Android Platform in Ionic framework in ubuntu

  14. 14

    Error while adding phone gap platform with Xcode 6.0-beta

  15. 15

    Error While Adding Cordova Plugin "sqlite-connector.jar" not found!"

  16. 16

    Error While Adding Cordova Plugin "sqlite-connector.jar" not found!"

  17. 17

    Error while adding Pushe cordova plugin to Intel® XDK project

  18. 18

    "Resource is out of Sync" error while generating target Platform in Eclipse

  19. 19

    Adding blackberry10 platform in cordova(3.0.0) is showing "Error: node cannot be found on the path. Aborting"

  20. 20

    Why is PhoneGap/Cordova not adding android platform?

  21. 21

    Error: cordova platform add android

  22. 22

    Cordova add platform android error

  23. 23

    Cordova add platform error in Ubuntu

  24. 24

    Android Studio 1.1.0 - Error while adding Fabric Crashlytics to app

  25. 25

    Getting Error while adding pubcenter ads in Metro App

  26. 26

    Error while adding username to my rails web app(devise gem)

  27. 27

    Exception while building android platform with cordova

  28. 28

    Exception while building android platform with cordova

  29. 29

    Cordova version error while using ionic to create new app although cordova is latest

HotTag

Archive