Missing Cordova.js Errors


#1

I’ve been scratching my head at this for days, I’ve searched GitHub, these forums and the Internet at large to no avail. Here’s the problem I’m having, I run the following command and the following output ensues:

$ ionic run android --device --debug --livereload --consolelogs --serverlogs --address 192.168.42.28
The port  was taken on the host 192.168.42.28 - using port 8000 instead
The port  was taken on the host 192.168.42.28 - using port 8000 instead

> ionic-hello-world@ ionic:serve [redacted]
> ionic-app-scripts serve "--port" "8000" "--address" "192.168.42.28" "--liveReloadPort" "8000" "--nobrowser" "--consolelogs" "--serverlogs"

[14:27:16]  ionic-app-scripts 0.0.45
[14:27:16]  watch started ...
[14:27:16]  build dev started ...
[14:27:16]  clean started ...
[14:27:16]  clean finished in less than 1 ms
[14:27:16]  copy started ...
[14:27:16]  transpile started ...
[14:27:21]  transpile finished in 4.84 s
[14:27:21]  webpack started ...
[14:27:21]  copy finished in 5.08 s
[14:27:28]  webpack finished in 7.30 s
[14:27:28]  sass started ...
[14:27:30]  sass finished in 1.73 s
[14:27:30]  build dev finished in 13.89 s
[14:27:30]  watch ready in 14.03 s
[14:27:30]  dev server running: http://192.168.42.28:8000/

I’m skipping the Android build output, but no errors there either.

[14:28:13]  console.warn: Native: tried calling BLE.enable, but Cordova is not available. Make sure to include
            cordova.js or run in a device/simulator
[14:28:13]  console.error: EXCEPTION: Uncaught (in promise): cordova_not_available
[14:28:13]  console.error: ORIGINAL STACKTRACE:
[14:28:13]  console.error: Error: Uncaught (in promise): cordova_not_available at s
            (http://192.168.42.28:8000/build/polyfills.js:3:8568) at s
            (http://192.168.42.28:8000/build/polyfills.js:3:8391) at http://192.168.42.28:8000/build/polyfills.js:3:8902
            at t.invokeTask (http://192.168.42.28:8000/build/polyfills.js:3:14051) at Object.onInvokeTask
            ([redacted]) at
            t.invokeTask (http://192.168.42.28:8000/build/polyfills.js:3:13987) at e.runTask
            (http://192.168.42.28:8000/build/polyfills.js:3:11411) at i
            (http://192.168.42.28:8000/build/polyfills.js:3:8028)
[14:28:13]  console.error: Unhandled Promise rejection: cordova_not_available ; Zone: angular ; Task: Promise.then ;
            Value: cordova_not_available null
[14:28:13]  console.warn: Native: tried calling StatusBar.styleDefault, but Cordova is not available. Make sure to
            include cordova.js or run in a device/simulator
[14:28:13]  console.warn: Native: tried calling Splashscreen.hide, but Cordova is not available. Make sure to include
            cordova.js or run in a device/simulator
[14:28:13]  console.log: Angular 2 is running in the development mode. Call enableProdMode() to enable the production
            mode.
[14:28:14]  console.warn: Native: tried accessing the Device plugin but Cordova is not available. Make sure to include
            cordova.js or run in a device/simulator
[14:28:14]  console.warn: Native: tried accessing the Device plugin but Cordova is not available. Make sure to include
            cordova.js or run in a device/simulator
[14:28:14]  console.warn: Ionic Insights: Device information unavailable.

A few things strike me about this output:

  1. The defaults listed for port (8100) and livereload-port (35729) are not being used when I start ionic
  2. The two can’t both run on 8000 as the output suggests (in fact they don’t, live reload is on it’s default port)
  3. Cordova.js is in the output directory (platforms/android/assets/www) which I assume is correct

Also, I noticed that -c and -s no longer work, while -l still does, but I’m much less worried about that.

$ ionic info
Your system information:

 ordova CLI: 6.4.0
Ionic Framework Version: 2.0.0-rc.3
Ionic CLI Version: 2.1.12
Ionic App Lib Version: 2.1.7
Ionic App Scripts Version: 0.0.45
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 8.1
Node Version: v7.0.0
Xcode version: Not installed

Edit: I forgot to point to the code: https://github.com/tjpeden/redbear-connect


#2

I’m having the exact same issue. When using ionic run android everything works fine and the app is able to boot cordova up. When i use ionic run android -lc i get this message

Native: tried calling StatusBar.styleDefault, but Cordova is not available. Make sure to include cordova.js or run in a device/simulator

And it will get thrown for every cordova plugin call as cordova is not loaded on the device in livereload mode?


#3

Known issue: driftyco/ionic-cli#1701