Running ionic on browser - ionic-framework

I am building a hybrid app using ionic 3 .While I try to run it in browser it gives me a "Missing Command Error".It runs on android and ios though.But i wanted to test it on browser too.

Testing your app in a browser is as simple as running the serve command in your project's root folder.
ionic serve
if you want to run in the ionic lab then run command.
ionic serve -l

Related

Ionic serve VS ionic serve -c

I'm new in Ionic and using Ionic 3.9.2
I got several terminal commands to serve my ionic-app but, I'm not getting any difference between these two commands.
ionic serve
and
ionic serve -c
This is basically short form of ionic serve --consolelogs for printing the log of you app in ionic CLI.(see the image)
There is second command to debug the app which is ionic serve --verbose
Hope this helps you to find out the difference.
ionic serve -c
or
ionic serve --consolelogs
will Print app console logs to your Ionic CLI.
Hope this helps
ionic serve -c will print console logs. If you have a mobile device connected on same wifi, then you can also view your app on the device as well using the ionDevApp .
To run in basic mode use
ionic serve
To run with console log in CLI
ionic serve -c
To run with livereload with console log in CLI
ionic serve -lc
To run with liverelaod in CLI
ionic serve -l
To run in android with livereload with console log in CLI
ionic run android -lc
To run in iOS with livereload with console log in CLI
ionic run ios -lc
Hope it helps

ionic app run perfectly on browser but not working on devApp and android apk

This question is related to ionic 3 and I want to know how to run an ionic app using a real device.
I have developed an hybrid application and I was not able to connect my app with server. It works fine in my laptop browser. But it does not work in devApp and android apk.
I have tried many solutions but was not able to get the perfect solution. I have made a proxy server to access the api by ionic devApp but it doesn't even show a single error.
I think this problem is related about CORS.
Use the additional parameter of --devapp when running your ionic serve.
ionic serve --devapp
Should work now.
For me allowing port 8100 in my firewall was needed. Then everythig works.
CORS is not a problem when you build your app on a real device.
To run your app on android device :
ionic cordova platform add android
ionic cordova build android
ionic cordova run android (Connect your device before executing this)
Try Reinstalling cordova-plugin-whitelist plugin.
I'd the same problem. But I just uninstalled and installed again the ionic DevApp and it solved it.
Try using the command ionic serve -c this for view the app into Ionic devApp
I am not sure if this helps now - In your DevAPp you have settings where you can manually enter IP address and port. This will be the private IP (192.x.x.x) and 8100 that is displayed when you start the ionic serve --devapp from the terminal.

Ionic App Serve not opening the Chrome Browser

I am trying to create a new Ionic Project it is displaying No browser in the Ionic serve command.
The Image 1 Shows the Info of the Ionic
The Issue where I click Ionic serve it is just displaying "No browser" it is not opening the chrome
Please Run This:
npm run ionic:serve --verbose
From your ionic root folder, it works for me...

LoopBack with Ionic

I am trying to run a LoopBack server with ionic client, but I am getting the "Error: Cannot GET /cordova.js" error.
My code can be cloned from github at: https://github.com/giladba/BetterTrader2.git
Problem description:
I created a LoopBack application, and at the client directory I created an Ionic tabs application.
After that, I ran these commands on the client directory:
ionic platform add android
ionic build android
In server/middleware.json I redirected the index.html folder to the Ionic www folder like so:
"files": {
"loopback#static": {
"params": "$!../client/www"
}
but when I run node . I get cordova.js not found when I open http://localhost:3000/ in the browser:
note that even though there is an exception the application seems to be working fine.
Any idea how I can fix the exception?
Cordova gets injected into the app when deployed on a mobile device. When you use the ionic serve command locally, for example, cordova.js always 404s. You don't need it unless you're on a mobile device in a cordova app, and it will be deployed automatically in that case.

My Ionic app works fine on browser but does not open in my phone

my ionic project works fine with ionic serve --lab ,but while copied the.apk file in build folder to my phone and install the app but blank screen appears ,
Please can anyone suggest what might be my problem
my app is using google maps,key is provieded for both app and browser in index.html
Have you tried running it in the emulator ? Since its much easier to see the error logs . Try ionic emulate android -l or ios -l (whichever OS you are building for) and then once the execution starts run the command consolelogs it will log all the activity and you will have a better understanding about why its not working.
+1 for using Chrome Remote Debugging feature. It give you the same output as you would receive from running you app in the browser.
Additionally, I have found that sometimes if your app is already compiled, the ionic CLI doesnt always copy your current files into the APK, and uses the older cached files instead. If you are banging your head against the wall, run the following commands to make sure you have your latest code in your APK.
ionic platform remove android
ionic platform add android
ionic run android
I suggest you use the Chrome Remote Debugging feature. I encountered the same, and looked for answers to my symptom for hours. Once I connected to the chrome remote debugger, I got the console.log back, and noticed there was a problem in my routing setup.
It was a problem with ionic CLI. I've updated it to the latest and reinstalled all dependencies.