question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Uncaught SyntaxError in vendor.js when running on Android

See original GitHub issue

Bug Report

Ionic Info Run ionic info from a terminal/cmd prompt and paste the output below.

Ionic:

   ionic (Ionic CLI)          : 4.0.3 (/usr/local/lib/node_modules/ionic)
   Ionic Framework            : @ionic/angular 4.0.0-beta.1
   @angular-devkit/core       : 0.7.2
   @angular-devkit/schematics : 0.7.2
   @angular/cli               : 6.1.2
   @ionic/ng-toolkit          : 1.0.2
   @ionic/schematics-angular  : 1.0.3

Cordova:

   cordova (Cordova CLI) : 8.0.0
   Cordova Platforms     : android 7.1.1, ios 4.5.5

System:

   Android SDK Tools : 26.1.1
   ios-deploy        : 2.0.0
   NodeJS            : v10.8.0 (/usr/local/Cellar/node/10.8.0/bin/node)
   npm               : 6.2.0
   OS                : macOS High Sierra
   Xcode             : Xcode 9.4.1 Build version 9F2000

Environment:

   ANDROID_HOME : /Users/heb/Library/Android/sdk

Describe the Bug Even the simplest myApp Ionic4/Angular6 demo does not proceed past the loading index.html when running on Android (device or emulator). Browser and iOS are fine.

Steps to Reproduce Steps to reproduce the behavior: 0. Make sure an Android SDK is installed and in the PATH and env variables

  1. Create a test app, e.g. via ionic start myApp tabs --type=angular
  2. Start logcat e.g. from command line via adb logcat
  3. Add the Android platform via ionic cordova platform add android
  4. Run ionic cordova emulate android
  5. App starts but shows a blank white page (which is the index.html)

Related Log During app start up in the emulator the logcat logs the following error which I think is the root cause for the app not continuing loading.

D/SystemWebChromeClient( 6353): http://localhost:8080/vendor.js: Line 71984 : Uncaught SyntaxError: Use of const in strict mode.
I/chromium( 6353): [INFO:CONSOLE(71984)] "Uncaught SyntaxError: Use of const in strict mode.", source: http://localhost:8080/vendor.js (71984)
D/CordovaWebViewImpl( 6353): onPageFinished(http://localhost:8080/)

Expected Behavior App should finish starting up.

Additional Context This error only happens on Android devices and the emulator, but not when starting the app on Android via the Ionic DevApp tool.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:31 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
snowyucommented, Aug 28, 2018

I found the reason: the compiled code of @ionic/angular is not the es5 code. It use the new async/await keyword in ES2017.

2reactions
hebracommented, Aug 9, 2018

Thanks @timhill1989 - I can confirm that it is actually working with Android 8.x but not any older version. Considering the current market share for Oreo of just 10% I see this as a blocker for Ionic 4 right now. At least 6 (23%) & 7 (34%) have to be supported as well, better include 5 (15%) as well.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unexpected token ? during run ionic 6 application on android ...
File: http://localhost/vendor.js - Line 24288 - Msg: Uncaught SyntaxError: Unexpected token ? when I run the application in the android ...
Read more >
Unexpected identifier vendor.js in android 5 and android 6.
App stucks with white screen and gives following error Uncaught SyntaxError: Unexpected identifier. Anyone have any idea. Thanks in advance.
Read more >
Ionic 4 and Angular 6: Uncaught SyntaxError in vendor.js ...
I am currently facing a problem when starting an Ionic 4 + Angular 6 when starting the App on any Android device or...
Read more >
Uncaught SyntaxError: Unexpected end of JSON input
A common error encountered by JavaScript programmers is the Uncaught SyntaxError: Unexpected end of JSON input. This is usually observed when the coder...
Read more >
Resolve! Uncaught SyntaxError: Unexpected token ',' or '
To create a production build for a remote server I usually run following ng command: $ ng build --prod But at the client...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found