# Ionic 5 capacitor Connection error: net::ERR\_CONNECTION\_REFUSED

**URL:** <https://forum.ionicframework.com/t/ionic-5-capacitor-connection-error-net-err-connection-refused/218641>\
**Category:** ionic-v3\
**Created:** [December 21, 2021, 2:09pm UTC](https://forum.ionicframework.com/t/ionic-5-capacitor-connection-error-net-err-connection-refused/218641 "2021-12-21T14:09:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![stefani0](https://avatars.discourse-cdn.com/v4/letter/s/2bfe46/32.png) [@stefani0](https://forum.ionicframework.com/u/stefani0)\
**Post date:** [December 21, 2021, 2:09pm UTC](https://forum.ionicframework.com/t/ionic-5-capacitor-connection-error-net-err-connection-refused/218641/1 "2021-12-21T14:09:21Z")

</div>

I have already created a new project on ionic 5 capacitor.

During build is giving issues on API and plugins. Have turned from localhost to private IP and the same issue.

 ![image](https://global.discourse-cdn.com/ionicframework/original/3X/c/7/c7bffe0d72ed67c70f6a1bc0a0cab573ea07b780.png)  
Have tried below steps for a build and also debug with andorid studio and same thing.

```auto

```

ionic build --prod  
npx cap sync  
npx cap open android

npm run build --prod  
npx cap copy  
npx cap open android

ionic capacitor run android --prod --release  
ionic capacitor sync android  
ionic capacitor run android -l --external --adress  
ionic capacitor run android --no-sync --target Pixel\_3\_API\_30

```auto

```

On android studio have modified the fiiles of AndroidManifest to allow trafic config.xml to allow all origins, alos @xml file

---

<div class="post-metadata">

**Author:** ![ciccilleju](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/ciccilleju/32/135142_2.png) [@ciccilleju](https://forum.ionicframework.com/u/ciccilleju)\
**Post date:** [December 22, 2021, 10:19am UTC](https://forum.ionicframework.com/t/ionic-5-capacitor-connection-error-net-err-connection-refused/218641/2 "2021-12-22T10:19:57Z")

</div>

try to execute just “ionic serve --prod” and see if the warning still appears

---

<div class="post-metadata">

**Author:** ![stefani0](https://avatars.discourse-cdn.com/v4/letter/s/2bfe46/32.png) [@stefani0](https://forum.ionicframework.com/u/stefani0)\
**Post date:** [December 24, 2021, 1:08pm UTC](https://forum.ionicframework.com/t/ionic-5-capacitor-connection-error-net-err-connection-refused/218641/3 "2021-12-24T13:08:30Z")

</div>

Problem fixed as below.

npm run ng build – --configuration production  
npx cap copy  
npx cap open android

---

<div class="post-metadata">

**Author:** ![hanho](https://avatars.discourse-cdn.com/v4/letter/h/b2d939/32.png) [@hanho](https://forum.ionicframework.com/u/hanho)\
**Post date:** [September 2, 2022, 3:02am UTC](https://forum.ionicframework.com/t/ionic-5-capacitor-connection-error-net-err-connection-refused/218641/4 "2022-09-02T03:02:24Z")

</div>

For me, same problem occurs when the capacitor or ionic or angular’s target NPM version is different.
