Hi there,
Anyone else struggling with this today? I can’t seem to be able to add any platform to my app… I ran both:
ionic cordova platform add ios
and
ionic cordova platform add android
But I get this error on both occasions:
> cordova platform add android --save
✖ Running command - failed!
[ERROR] Exception: Error: Invalid or unexpected token
ionic info:
@ionic/cli-utils : 1.9.2
ionic (Ionic CLI) : 3.9.2
global packages:
Cordova CLI : 7.0.1
local packages:
@ionic/app-scripts : 2.1.3
Cordova Platforms : none
Ionic Framework : ionic-angular 3.6.0
System:
ios-deploy : 1.9.2
Node : v6.11.3
npm : 3.10.10
OS : macOS Sierra
Xcode : Xcode 8.3.3 Build version 8E3004b```
Sujan12
September 12, 2017, 1:42pm
2
Uh, that is a strange one. Can you run the same command with --verbose
and -- -d
added at the end and post the complete output if it is different from what you already have?
[DEBUG] CLI flags: { interactive: true, confirm: false }
[DEBUG] { cwd: '/Users/user/Documents/folder/app', local: true, binPath:
'/usr/local/lib/node_modules/ionic/bin/ionic', libPath:
'/Users/user/Documents/folder/app/node_modules/ionic/dist/index.js' }
[DEBUG] New daemon pid: 1399
> cordova platform add ios --save
✖ Running command - failed!
[ERROR] Exception: Error: Invalid or unexpected token
Sujan12
September 12, 2017, 3:35pm
4
Which one of the both commands is this the output for?
Try cordova platform add ios -d
please.
Hi there! Sorry, I accidentally ran it with all the extra bits:
ionic cordova platform add android --verbose and -- -d
ok, so when I run with cordova platform add android --verbose I get:
Error: Invalid or unexpected token
when I run with cordova platform add ios --d I get:
Error: Invalid or unexpected token
when I run with ionic cordova platform add android – -d I get:
> cordova platform add android --save
✖ Running command - failed!
[ERROR] Exception: Error: Invalid or unexpected token
Sujan12
September 12, 2017, 8:53pm
6
No additional output? Strange.
Look at your config.xml, is it a valid file?
What is in your /platforms
folder?
Yep, everything looks dandy in my config.xml file…
My platforms folder has:
{}
I currently don’t have any platforms installed… I had, but I removed them, and when I tried re-installing them that’s when I started facing this problem.
Sujan12
September 12, 2017, 9:02pm
8
Delete the whole folder.
Problem is that there is no real output what is having an unexpected token…
Sometimes this idiom can be helpful narrowing down at least the last file to be opened before something pukes:
$ strace -eopen -f ionic whatever
1 Like
Hi there…
Deleted the platforms folder and still the same error when trying to add platforms:
> cordova platform add android --save
✖ Running command - failed!
[ERROR] Exception: Error: Invalid or unexpected token
Sujan12
September 12, 2017, 9:38pm
11
So its not that. Can you replace your config.xml
with a default one?
Or try the same command with a new project created with ionic start
?
Cool, thanks, will do… If I encounter additional issues I’ll let you know. thanks.