Different error on different devices

Hello,
I’m testing my Ionic 2 app on three different devices but I have three different behaviours:

  • Moto G2 (Android 6.0): The app works flawlessly
  • LG Nexus 5 (Android 6.0.1): I have this error: “Uncaught SyntaxError: missing ) after argument list”
  • Samsung S3 Neo (Android 4.4.2): I have this error: “Uncaught SyntaxError: Use of const in strict mode.”

Is there a way to debug effectively? Because I just see the error message in the debug console, but it doesn’t mention any line number or file.
How can I solve these problems?

Thanks,
Stefano

Can you execute and post your output of

ionic info

maybe the Node version has something to do with those errors.

Hi,
this is the output of the info command:

Cordova CLI: 6.2.0 Gulp version: CLI version 1.2.1 Gulp local: Local version 3.9.1 Ionic Framework Version: 2.0.0-beta.9 Ionic CLI Version: 2.0.0-beta.25 Ionic App Lib Version: 2.0.0-beta.15 ios-deploy version: 1.8.6 ios-sim version: 5.0.8 OS: Mac OS X El Capitan Node Version: v6.2.0 Xcode version: Xcode 7.3 Build version 7D175

There are two issues that I can see there:
I have Ionic CLI Version: 2.0.0-beta.32 (try upgrading your beta.25) and in the other hand there’s stuff in Ionic CLI that doesn’t work nicely with Node 6, so I suggest to downgrade it to Node 5.12.0 and try again :wink:

I tried to create a new project with the same version and there aren’t problems with all devices…
Maybe the problem is not the CLI or node version?

Thanks

You gotta check the Exception trace of those error messages then, because that missing ) Syntax error should be seen on any device… are you using typescript or your project is still JS/ES6? TS would help to debug that easily.

How can I see the Exceptions trace?
I can confirm that I see the error missing ) only with Nexus 5.
I’m using typescript but I don’t know how to debug the code.

I had issues with libraries published with arrow functions and stuff like this. Since Ionic does not transpile them currently. Check you dependencies.

Sometimes when I change something in the code I have this error:
Failed to load resource: net::ERR_FILE_NOT_FOUND (file:///android_asset/www/build/js/app.bundle.js)
Is there a way to understand where is the error?

Thanks

This means that there was an error while compiling your typescript. Probably in the initial run. Then there is no app.bundle.js generated, therefore the fail to load error. When this happens after the initial load the app.bundle will not be created as well but the old one is still there. But as already mentioned not on the first compile after ionic serve / emulate / run.

So: fix your errors.

So is there an help to find the errors?

try https://developers.google.com/web/tools/chrome-devtools/debug/remote-debugging/remote-debugging?utm_source=dcc and the device monitor from android studio. Also try to run the app using

ionic run android --device -l -s -c for all possible logging

With ionic run android --device -l -s -c command I always have this error:
Error getting IPv4 address: TypeError: String.prototype.small called on null or undefined (CLI v2.0.0-beta.25)

Moreover I would try to upgrade CLI version but I don’t understand how to do it.

You should update ionic-cli. You’re behind :slight_smile:

npm install -g ionic.

I made some progress but It still doesn’t work.
How can enable device to access to the IP that I selected? Does It matter the choise of the IP?

Thanks

Can someone help me?

Hi… is there a solution for that? is ionic2 still not supported by node6 ? I’m having the error on console: Uncaught SyntaxError: Use of const in strict mode.

This is for a android 4.2.2


Cordova CLI: You have been opted out of telemetry. To change this, run: cordova telemetry on.
6.3.1

Gulp version:  CLI version 3.9.1
Gulp local:   Local version 3.9.1

Ionic Framework Version: 2.0.0-beta.11
Ionic CLI Version: 2.1.0
Ionic App Lib Version: 2.1.0-beta.1
ios-deploy version: 1.4.0
ios-sim version: 3.1.1
OS: Mac OS X El Capitan
Node Version: v6.3.1
Xcode version: Xcode 7.3.1 Build version 7D1014 ```

Hi @mariomol, did you resolve the issue?

We have a problem on android, where we have the same error message as you.

Yes… in my case i had a error on my code… but for some reason ionic/phonegap where hidden the original error passing this ...strict mode

So, open your app in a browser. . or try to console.log some places in your code to see where you might have the problem

the error was a stupid thing… but i cant remember if was a compile error or execution error…