[SOLVED] Unexpected token <


#1

Hi All,
i’m using Ionic DevApp and i have a strange problem.
When i use it on my smartphone all work correctly, but on tablet i have this strange error:

SyntaxError: Unexpected token <

Info:

Ionic Framework: ^3.9.2
Ionic App Scripts: 3.1.0
Angular Core: 5.0.0
Angular Compiler CLI: 5.0.0
Node: 6.11.4
OS Platform: macOS Sierra
Navigator Platform: MacIntel
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:56.0) Gecko/20100101 Firefox/56.0

Package.json

{
.....
  "scripts": {
    "clean": "ionic-app-scripts clean",
    "build": "ionic-app-scripts build",
    "lint": "ionic-app-scripts lint",
    "ionic:build": "ionic-app-scripts build",
    "ionic:serve": "ionic-app-scripts serve"
  },
  "dependencies": {
    "@angular/animations": "5.0.0",
    "@angular/common": "5.0.0",
    "@angular/compiler": "5.0.0",
    "@angular/compiler-cli": "5.0.0",
    "@angular/core": "5.0.0",
    "@angular/forms": "5.0.0",
    "@angular/http": "5.0.0",
    "@angular/platform-browser": "5.0.0",
    "@angular/platform-browser-dynamic": "5.0.0",
    "@ionic-native/core": "4.3.3",
    "@ionic-native/email-composer": "4.3.3",
    "@ionic-native/facebook": "4.3.3",
    "@ionic-native/google-plus": "4.3.3",
    "@ionic-native/http": "4.3.3",
    "@ionic-native/launch-navigator": "4.3.3",
    "@ionic-native/onesignal": "4.3.3",
    "@ionic-native/splash-screen": "4.3.3",
    "@ionic-native/status-bar": "4.3.3",
    "@ionic-native/twitter-connect": "4.3.3",
    "@ionic/storage": "2.1.3",
    "@ngx-translate/core": "^8.0.0",
    "@ngx-translate/http-loader": "^2.0.0",
    "cordova-android": "^6.2.3",
    "cordova-ios": "^4.5.1",
    "cordova-plugin-actionsheet": "^2.3.3",
    "cordova-plugin-add-swift-support": "^1.7.0",
    "cordova-plugin-advanced-http": "^1.6.1",
    "cordova-plugin-compat": "^1.2.0",
    "cordova-plugin-device": "^1.1.4",
    "cordova-plugin-dialogs": "^1.3.3",
    "cordova-plugin-email-composer": "^0.8.11",
    "cordova-plugin-facebook4": "^1.9.1",
    "cordova-plugin-file": "^4.3.3",
    "cordova-plugin-googleplus": "^5.1.1",
    "cordova-plugin-ionic": "^2.0.3",
    "cordova-plugin-ionic-webview": "^1.1.14",
    "cordova-plugin-splashscreen": "^4.0.3",
    "cordova-plugin-statusbar": "git+https://github.com/apache/cordova-plugin-statusbar.git",
    "cordova-plugin-whitelist": "^1.3.1",
    "cordova-sqlite-storage": "^2.0.4",
    "ionic-angular": "^3.9.2",
    "ionic-plugin-keyboard": "^2.2.1",
    "ionicons": "3.0.0",
    "onesignal-cordova-plugin": "^2.2.2",
    "rxjs": "5.5.2",
    "sw-toolbox": "3.6.0",
    "twitter-connect-plugin": "git+https://github.com/chroa/twitter-connect-plugin.git",
    "uk.co.workingedge.phonegap.plugin.launchnavigator": "^4.0.5",
    "web-animations-js": "^2.3.1",
    "zone.js": "0.8.18"
  },
  "devDependencies": {
    "@ionic/app-scripts": "^3.1.0",
    "typescript": "2.4.2"
  },
  "description": "An Ionic project",
  "cordova": {
    "platforms": [
      "android",
      "ios"
    ]}
  .....
}

Today i’ve updated all to 3.9.2, before i haven’t this error.
Ionic doctor check not detect issue.

Can you help me?

Thanks


#2

Same error run "Ionic cordova run android --device"
Major details here: https://stackoverflow.com/questions/47229131/ionic-3-unexpected-token


#3

Have you checked to see if somewhere in your HTML or ts files there’s a < where there shouldn’t be?


#5

Crosswalk project isn’t maintained. Is it a good solution i don’t know.
Well anyway,
This leads me to creating two files :
android-x86-release-unsigned.apk
and
android-armv7-release-unsigned.apk

What do i have to do with this ?
It’s hard to find any help on this.

Maybe, it would be more interesting to update typescript but due to some dependencies i just can’t do it problem of dependencies.
Any news ?


#6

No news, same error only on tablet with android 4.4.4
I checked html and ts files but no found “<”

I no longer know what to look and do :frowning:


#7

New investigation: the problem is on device with android version <= 4.4.4 either smartphone and tablet.
But Ionic 3 does not natively support android 4.4+?


#8

I got this problem on an all new fresh node npm ionic cordova install.

I took my time to learn Ionic, seeing these kind of things just coming it’s just too hard to handle.
It’s not possible to produce any ionic 3 for the moment with theses kind of problem !


#9

What about in your config.xml? Any stray < there? I know it’s looking like a versioning problem with android or whatever, but if it’s a ‘syntax’ error, that suggests that an element < is causing an error. Maybe it’s just getting noticed in certain situations. Config xml does have a lot of < and >


#10

Problem solved.
I’ve installed crosswalk plugin and now all work. :slight_smile:


#11

Crosswalk is Evil lol. It’s not maintained anymore.


#12

Ok it is evil.
Ionic should support 4.4+ but if it does not …


#13

I had this problem,
i took all my code to a new starter, and you know what, everything is ok, without crosswalk.
So i you can you should do that, maybe there is one change we couldn’t figure out.


#14

I also get uncaught SyntaxError: Unexpected token (working with my phone android 7 but not working on the tablet android 4x the same problem does not work on the lower ios version of the project i use ionic 3.1 can i have a problem related to es6?