Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cordova.js not found. #486

Closed
HelloGrayson opened this issue Jan 29, 2014 · 15 comments
Closed

cordova.js not found. #486

HelloGrayson opened this issue Jan 29, 2014 · 15 comments

Comments

@HelloGrayson
Copy link

I just created an app using ionic create command. Then I start the app for viewing in the browser like so:

cd wwww
python -m SimpleHTTPServer 8000

When I access the app in the browser everything looks fine, except that I get the following error.

GET 127.0.0.1:8000/cordova.js 404 (File not found)

Any idea what the deal is?

@dryaf
Copy link

dryaf commented Jan 29, 2014

this will be aded by phonegap when you compile it for ios, android or whatever.

@dbaq
Copy link

dbaq commented Jan 29, 2014

phonegap build will add this file

@HelloGrayson
Copy link
Author

So this is expected behavior when using ionic in the browser?

@HelloGrayson
Copy link
Author

I ran ionic build ios before accessing my app in the browser but I still get this error.

@dbaq
Copy link

dbaq commented Jan 29, 2014

There is no issue with ionic, this is the good behavior. The cordova.js file is added when you compile your app with ionic build ios | android, go to platforms/ios/www/ you should see cordova.js

cordova.js is only useful for phonegap, if you are using your app in a browser you don't care about this file.

@HelloGrayson
Copy link
Author

Right... so running from www as oppossed to platforms/ios/www will cause the file not to exist... I've been running from www for development... What are you guys doing? Is cordova even needed for development?

@HelloGrayson
Copy link
Author

Would be nice if there was a way to not attempt to include that file if it is not a result of a build step...

@dbaq
Copy link

dbaq commented Jan 29, 2014

yep you are right. it really depends on your needs, are you writing a mobile native app?
=> no. Ionic is focused on mobile native app, so may be it is not a good fit (correct me if I am wrong)
=> yes. it depends on your features, do you need to access to the contacts list, to the camera, to the accelerometer ? if yes, you will have to test these features on your phone or on an emulator and (basically) cordova.js is the bridge between native plugin and your JS code. otherwise you don't care about cordova and you don't need this file to develop.
to develop anything else you can run your app from www

I am not sure, but as I said, Ionic is focused right now on mobile native app, not on browser. So it is logical to have this file because you are going to compile your device for one or multiple platforms.

you should read http://cordova.apache.org/

@sidneys
Copy link

sidneys commented Jan 29, 2014

Of course Ionic is targeted at mobile apps, but common developer workflows will at some point always resort to using a browser for testing and debugging, not only because Safari (with UIWebview Inspection) is lacking the deep-end debugging tools required for hard-core performance optimizations that for example chrome developer tools have (etc., high resolution frame inspection or Angular Batarang). You solve that by 1. always wrapping calls to cordova functions into generalized Cordova Wrapper functions (e.g., checking if cordova is available, if so, produce navigator.notification.alerts instead of plain alert(), see the talk be C. Conraets given recently) and first of foremost only including cordova.js if a Webview environment has been detected. These are only some of the experiences i made in a very large project, ongoing, targeting iOS & Android using Angular & Cordova. But these features can easily be added to Ionic.

@mlynch mlynch closed this as completed Jan 29, 2014
@mlynch
Copy link
Contributor

mlynch commented Jan 29, 2014

Great discussion. Right now Ionic is focused only on Cordova built mobile apps. The nice thing about this is it lets us do lots of gesture based UI that the browser unfortunately breaks for mobile web apps (like side menus that Chrome and Safari use for switching tabs/going back).

If you aren't relying on Cordova features, this script error is harmless. However, if you need cordova available when running the app, I suggest using the simulator or running on the device. Another alternative is to use the Ripple Emulator which basically mocks the phonegap/cordova API, but it hasn't really be updated recently AFAIK.

We've got a ton of things planned with Ionic, and making a great test environment that helps you develop cordova based apps without the cordova build/emulate/run cycle is on that list, so stay tuned!

@CoffeeMatt
Copy link

I also ran into this right away as my app does need some Cordova features. Will need to jury-rig it for now but it would be great if there were a slick way to handle this so I can do most of my testing in Chrome.

@mlynch
Copy link
Contributor

mlynch commented Feb 12, 2014

One option is to use the Ripple emulator which emulates some of the stuff.
But for now, if you really need device stuff, it's best to test in the
simulator or on the device, which is what you'd do with normal native
development. Hope that helps!

On Wed, Feb 12, 2014 at 10:50 AM, Matthew notifications@github.com wrote:

I also ran into this right away as my app does need some Cordova features.
Will need to jury-rig it for now but it would be great if there were a
slick way to handle this so I can do most of my testing in Chrome.


Reply to this email directly or view it on GitHubhttps://github.com//issues/486#issuecomment-34888801
.

@gopidon
Copy link

gopidon commented Mar 2, 2014

Cordova.js is not needed while testing on the browser. It gets auto included while deploying on a real device/emulator.

@nvcken
Copy link

nvcken commented Aug 22, 2014

how can I debug android app + plugin push notification , seem It can not debug on browser (ionic serve) , right? How can I see console.log when ionic run android cmd.
I have implement ngCordova + PhoneGap PushPlugin, I have include PushNotification.js as below order

script src="lib/ngCordova/dist/ng-cordova.js"
script src="cordova.js"
script src="js/PushNotification.js"

Then ionic serve show error log cordova is not defined.
Please tell what I am wrong?

@Jaiqson
Copy link

Jaiqson commented Dec 3, 2015

Comment in IONIC Slidemenu exemple:

cordova script (this will be a 404 during development)

=)

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Sep 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants