Ionic upload: SyntaxError: Unexpected token < in JSON at position 0


#1

Suddenly out of nowhere I get the following error when uploading with ionic upload. App is working fine in the browser and builds fine. I tried setting the app_id value to empty string in ionic.config.json, but still no luck.
I wonder if its related to https://apps.ionic.io/ being down right now?

Uploading app…

An error occurred uploading the build: SyntaxError: Unexpected token < in JSON at position 0

SyntaxError: Unexpected token < in JSON at position 0
at Object.parse (native)
at IncomingMessage. (/usr/local/lib/node_modules/ionic/node_modules/ionic-app-lib/lib/upload.js:309:25)
at emitNone (events.js:91:20)
at IncomingMessage.emit (events.js:185:7)
at endReadableNT (_stream_readable.js:974:12)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickCallback (internal/process/next_tick.js:98:9)

Unexpected token < in JSON at position 0 (CLI v2.2.1)

Your system information:

Cordova CLI: 6.4.0
Ionic Framework Version: 2.0.0
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
Ionic App Scripts Version: 1.0.0
ios-deploy version: Not installed
ios-sim version: 5.0.13
OS: macOS Sierra
Node Version: v6.9.1
Xcode version: Xcode 8.2.1 Build version 8C1002


#2

Apparently it was due to https://apps.ionic.io/ being down as I can upload now again without any problem.


#3

I have the same issue however with another Token. Do we have to have our app linked to ionic.io?


#4

Where you trying to upload the app by using ionic upload?


#5

no, i just wanted to debug it on my device via
ionic run android
Just like you, it builds and runs fine on browser


#6

I was actually doing ionic upload to the Ionic View app on my device, not no the emulator. But you might want to add more info (e.g. the exact error) to your question to get better answers.


#7

My error says:

Error: Unexpected token / in JSON at position 404

#8

I resolve this problem by removing platform (i.e. ionic platform rm android ). And add platform (i.e. ionic platform add android ) again.