Description:
Unable to install cordova plugins using ionic cordova add plugin. I get the errors for every plugin I try to install this way.
Steps to Reproduce:
Install a plugin using ionic cordova add plugin. I have tried this thousands of times, tried upgrading to the latest cordova, but nothing help, unless I install the plugins using cordova add plugin
Output:
Error: Text data outside of root node.
Line: 178
Column: 1
Char: n
at error (/Users/jacques/dev/mobile/node_modules/elementtree/node_modules/sax/lib/sax.js:666:10)
at strictFail (/Users/jacques/dev/mobile/node_modules/elementtree/node_modules/sax/lib/sax.js:692:7)
at Object.write (/Users/jacques/dev/mobile/node_modules/elementtree/node_modules/sax/lib/sax.js:1035:15)
at XMLParser.feed (/Users/jacques/dev/mobile/node_modules/elementtree/lib/parsers/sax.js:48:15)
at ElementTree.parse (/Users/jacques/dev/mobile/node_modules/elementtree/lib/elementtree.js:271:10)
at Object.parse (/Users/jacques/dev/mobile/node_modules/elementtree/lib/elementtree.js:584:8)
at Function.<anonymous> (/Users/jacques/dev/mobile/node_modules/@ionic/cli-utils/lib/cordova/config.js:35:28)
at next (native)
at fulfilled (/Users/jacques/dev/mobile/node_modules/tslib/tslib.js:100:62)
My ionic info:
cli packages: (/Users/jacques/dev/mobile/node_modules)
@ionic/cli-utils : 1.19.0
ionic (Ionic CLI) : 3.19.0
global packages:
cordova (Cordova CLI) : 6.5.0
Gulp CLI : CLI version 3.9.1 Local version 3.9.1
local packages:
Cordova Platforms : none
Ionic Framework : ionic1 1.3.5
System:
ios-deploy : 1.9.2
Node : v6.11.0
npm : 2.15.12
OS : macOS High Sierra
Xcode : Xcode 9.1 Build version 9B55
It seems this issue is caused by the reformatting of the config.xml file - as mentioned here. https://github.com/ionic-team/ionic-cli/issues/2230
It seems to sometimes add incomplete nodes while it's going through all the plugins to install - which then breaks any other plugins being installed. (I tend install a bunch of them at a time using a gulp task, especially when switching environments).
So going to switch to the original cordova add plugin for the moment.
What method do you use to install a bunch of them at a time?
I basically wrap each one in a promise, which is executed by sh.exec.
const addPlugin = (plugin) => {
return new Promise((resolve, reject) => {
sh.exec(
'ionic cordova plugin add ' + plugin,
{ async: true },
(code, output) => {
if (code === 1) {
reject(plugin)
}
resolve(plugin)
})
})
}
I get this error:
$ ionic cordova plugin add cordova-plugin-firebase-dynamiclinks --save --variable APP_DOMAIN="myname.app.goo.gl" --variable APP_PATH="/"
Error: Forward-slash in opening tag not followed by >
Line: 60
Column: 0
Char:
at error ( ...npm-global/lib/node_modules/ionic/node_modules/sax/lib/sax.js:666:10)
UPDATE: sorry, there was an error in config.xml
Check your config.xml file, usually the end of it - you will probably see a xml node starting with />.
You should just be able to delete the weird bit of code at the end and try again
thanks, it was that problem
Since Last Two Days I am trying to install cordova-plugin-firebase-dynamiclinks but i am getting folowing I have search on google for error but I am not getting any solution and I am not able to understand why this error is comming. Please help
I get this error:
D:\Apps\myapp>ionic cordova platform add android
cordova.cmd platform add android
Using cordova-fetch for cordova-android@^8.0.0
Adding android project...
Creating Cordova project for the Android platform:
Path: platforms\android
Package: com.myapp.application
Name: MyApp
Activity: MainActivity
Android target: android-28
Subproject Path: CordovaLib
Subproject Path: app
Android project created with [email protected]
Installing "cordova-plugin-android-permissions" for android
Installing "cordova-plugin-androidx" for android
Installing "cordova-plugin-androidx-adapter" for android
Installing "cordova-plugin-contacts" for android
Installing "cordova-plugin-device" for android
Installing "cordova-plugin-firebase-dynamiclinks" for android
Plugin dependency "[email protected]" already fetched, using
that version.
Installing "cordova-support-android-plugin" for android
Plugin dependency "[email protected]" already fetched, usin
that version.
Installing "cordova-support-google-services" for android
Subproject Path: CordovaLib
Subproject Path: app
Failed to install 'cordova-plugin-firebase-dynamiclinks': Error: Invalid charac
er in entity name
Line: 0
Column: 283
Char: =
at error (D:\Apps\myappnode_modules\elementtreenode_modules\saxlib\
ax.js:666:10)
at strictFail (D:\Apps\myappnode_modules\elementtreenode_modules\sax
lib\sax.js:692:7)
at SAXParser.write (D:\Apps\myappnode_modules\elementtree\node_module
\saxlib\sax.js:1491:13)
at XMLParser.feed (D:\Apps\myappnode_modules\elementtreelibparsers\
ax.js:48:15)
at ElementTree.parse (D:\Apps\myappnode_modules\elementtreelib\eleme
ttree.js:271:10)
at Object.exports.XML (D:\Apps\myappnode_modules\elementtreelib\elem
nttree.js:606:13)
at ConfigFile_graft_child [as graft_child] (D:\Apps\myappnode_modules
cordova-common\src\ConfigChanges\ConfigFile.js:107:40)
at PlatformMunger_apply_file_munge [as apply_file_munge] (D:\Apps\myapp
node_modules\cordova-common\src\ConfigChanges\ConfigChanges.js:81:34)
at munge_helper (D:\Apps\myappnode_modules\cordova-common\src\ConfigC
anges\ConfigChanges.js:252:14)
Invalid character in entity name
Line: 0
Column: 283
Char: =
at PlatformMunger.add_plugin_changes (D:\Apps\myappnode_modules\cordo
a-common\src\ConfigChanges\ConfigChanges.js:159:12)
[ERROR] An error occurred while running subprocess cordova.
cordova.cmd platform add android exited with exit code 1.
Re-running this command with the --verbose flag may provide more
information.
Most helpful comment
Check your config.xml file, usually the end of it - you will probably see a xml node starting with />.
You should just be able to delete the weird bit of code at the end and try again