Lots of errors in Cordova!


#1

I have Cordova 3.5.0 installed and the latest Ionic (1.0.14 from npm) and I’m getting a number of errors:

[Error] Deprecated attempt to access property 'userAgent' on a non-Navigator object. invoke (ionic.bundle.js, line 12639) [Error] Deprecated attempt to access property 'platform' on a non-Navigator object. platform (ionic.bundle.js, line 2158) [Error] Deprecated attempt to access property 'geolocation' on a non-Navigator object. (anonymous function) (cordova.js, line 1221) [Error] Deprecated attempt to access property 'geolocation' on a non-Navigator object. assignOrWrapInDeprecateGetter (cordova.js, line 484) [Error] Deprecated attempt to access property 'userAgent' on a non-Navigator object. (anonymous function) (statusbar.js, line 27) [Error] TypeError: undefined is not an object (evaluating 'navigator.userAgent.indexOf') require (cordova.js, line 71) [Error] Deprecated attempt to access property 'userAgent' on a non-Navigator object. main (main.js, line 54) [Log] deviceready has not fired after 5 seconds. (console-via-logger.js, line 173) [Log] Channel not fired: onCordovaReady (console-via-logger.js, line 173) [Log] Channel not fired: onCordovaInfoReady (console-via-logger.js, line 173) [Log] Channel not fired: onCordovaConnectionReady (console-via-logger.js, line 173)

I only see the errors referencing ionic.bundle.js and cordova.js. These errors occur in the browser when I run them off cordova serve but not when I run python -m SimpleHTTPServer 8000. They also occur when I run a build and test on my device with Xcode.

Any idea what these might be?


#2

Woah thats crazy, I haven’t seen those before. Can you provide the steps you took and got this? Or could you try making a new project with our CLI and see if this happens?


#3

Thanks for the quick response!

I tried starting a brand new project and still see these errors in my Safari Inspector from the app built in Xcode.

Here is exactly what I did to recreate:

ionic start test-project cd test-project ionic platform add ios ionic build ios

Then in Xcode, I opened up the new project and ran the app using my actual iPhone as the emulator. Once the app was running, I used Safari’s Web Inspector to view my console and saw this:

[Error] Deprecated attempt to access property 'userAgent' on a non-Navigator object. invoke (ionic.bundle.js, line 12639) [Error] Deprecated attempt to access property 'userAgent' on a non-Navigator object. getInfo (device.js, line 74) [Error] TypeError: undefined is not an object (evaluating 'navigator.userAgent.indexOf') iOSExec (cordova.js, line 924) [Log] deviceready has not fired after 5 seconds. (console-via-logger.js, line 173) [Log] Channel not fired: onCordovaInfoReady (console-via-logger.js, line 173)

The test app seems to navigate around properly but on my app that I’m working on, I need to do some geolocation and other things that require me to wait until plugins are loaded and ready() before I can fire off some functionality that I wrote to look up location, set some sort preferences, etc.

If you would like to view my project code, feel free since what I am working on is supposed to be released open source:

Make sure you look at the branch ‘switching-api-service’ - I’m still in the process here of re-wiring up my app to work with the API service I am building but that’s the latest.

Thanks!


#4

Same error to report here! Deprecated attempt to access property 'userAgent' on a non-Navigator object.. I’m using Ember and Cordova in my project (not sure about OP), so I thought one of those might be the cause of this error, but a Google Search took me here so now I’m thinking it’s my use of Ionicons. OP, did you find a fix?

EDIT

I’d like to point to this Cordova/iOS 8 issue: https://issues.apache.org/jira/browse/CB-6911


#5

I’m getting the exact same error in the IOS emulator

Deprecated attempt to access property ‘userAgent’ on a non-Navigator object.

Has anyone solved this?


#6

So the post above.

https://issues.apache.org/jira/browse/CB-6911

Cordova needs to push some plugin updates


#7

anyone know if this has been solved on Cordova’s end yet?

If not, how can we manually fix it within our Ionic app?


#8

Best place to check would be on cordova site.

http://cordova.apache.org/#news

They post when they update their CLI (which ionic is built on), plugins, and platforms.