net::ERR_CONNECTION_REFUSED ionic
- DKC Career
- Oct 11, 2020
- 2 min read
Updated: Jul 20, 2021
web page not able to load http://localhost/ ionic issue
If you are reading this means i assume you already know about IONIC platform and used to convert you app in android/ios application.
When we build ionic application it run successfully on pc's browser and don't give any error. but when we run it in emulator/android/ios phone we mostly get below error:
net::ERR_CONNECTION_REFUSED
web page not able to load
If you are not able to see the app in browser then please resolve that issue first because if you are not able to see your application by using command ionic serve --project"projectName" then you need to correct config file in the root directory. Some time the issue don't come while you build the project so i will suggest to debug application before run, use below command and see the logs to reach on actual error:
ionic cordova run android -l -c --device --verbose
OR
ionic cordova run android --project "Name" -l -c --device --verbose
Let's come on the Issue, I faced this issue mostly and also helped many people in the same. The issue is because your cordova android/ios api got broken due to upgrade/downgrade version's. Please run below command to see the cordova api stats(i am testing for android):
Here you can see the android api status is broken so we need to correct it. There are two ways to do it one provide exact version or second is to use the latest one which is available. you can find the cordova-android version list with supported android version from https://cordova.apache.org/docs/en/latest/guide/platforms/android/

Command to update/add android api:
cordova platform remove android
ionic cordova platform add android@latest
OR
cordova platform add android@6.0.0 --save
Now again you can list the cordova api, you will see the android api is correct now. Again try to run the application you won't get the error this time.

Please let know if this solve your issue also comment if still issue persist, i will look on that but please use debug command to see the actual issue. Thanks for visiting.
Comments