"ECONNREFUSED" on http request



我有一个Ionic应用程序,迄今为止工作良好,但突然我得到这个错误,当我做一个http请求。(通过运行"离子服务",没有任何平台)。我想这与版本之类的问题有关。

错误:connect ECONNREFUSED 127.0.0.1:8561在TCPConnectWrap。afterConnect [as oncomplete] (net.js:1146:16)

服务器工作正常,并响应来自Postman的请求。

这是包的详细信息:

  • 离子-v 6.17.0
  • cordova - v10.0.0

Package.json:

"dependencies": {
"@angular/cdk": "^6.3.1",
"@angular/common": "^5.0.0",
"@angular/compiler": "^5.0.0",
"@angular/compiler-cli": "^5.0.0",
"@angular/core": "^5.0.0",
"@angular/forms": "^5.0.0",
"@angular/http": "^5.0.0",
"@angular/material": "^6.3.1",
"@angular/platform-browser": "^5.0.0",
"@angular/platform-browser-dynamic": "^5.0.0",
"@ionic-native/app-version": "^4.9.0",
"@ionic-native/core": "^4.9.0",
"@ionic-native/diagnostic": "^4.9.0",
"@ionic-native/downloader": "^4.20.0",
"@ionic-native/estimote-beacons": "^4.9.0",
"@ionic-native/ibeacon": "^4.9.0",
"@ionic-native/keyboard": "^4.9.0",
"@ionic-native/push": "^4.9.0",
"@ng-idle/core": "^2.0.0-beta.15",
"@ng-idle/keepalive": "^2.0.0-beta.15",
"android-versions": "^1.4.0",
"angular2-moment": "^1.9.0",
"connect": "^3.6.3",
"cordova-android": "8.1.0",
"cordova-plugin-app-version": "^0.1.9",
"cordova-plugin-ble": "^2.0.1",
"cordova-plugin-camera": "^4.0.0",
"cordova-plugin-console": "^1.0.7",
"cordova-plugin-device": "^1.1.7",
"cordova-plugin-geolocation": "^4.0.2",
"cordova-plugin-ibeacon": "^3.6.1",
"cordova-plugin-splashscreen": "^6.0.0",
"cordova-plugin-statusbar": "^2.1.3",
"cordova-plugin-whitelist": "^1.3.3",
"cordova-plugin-wkwebviewxhrfix": "^0.1.0",
"ion-datepicker": "^2.7.7",
"ion2-calendar": "^2.1.7",
"ion2-code-calendar": "0.0.5",
"ionic-angular": "^3.9.2",
"ionic-native": "2.4.1",
"ionic-plugin-keyboard": "^2.2.1",
"ionicons": "3.0.0",
"lodash": "^4.17.4",
"lodash.assign": "^4.2.0",
"lodash.clonedeep": "^4.5.0",
"moment": "^2.29.0",
"ngx-webstorage": "^2.0.0",
"numeral": "^2.0.6",
"phonegap-plugin-push": "^2.3.0",
"promise-polyfill": "6.0.2",
"raven-js": "^3.17.0",
"rxjs": "5.5.2",
"sharp": "^0.23.3",
"sw-toolbox": "3.6.0",
"zone.js": "0.8.18"
},
"devDependencies": {
"@ahovakimyan/cordova-plugin-wkwebviewxhrfix": "git+https://github.com/AraHovakimyan/cordova- 
plugin-wkwebviewxhrfix.git",
"@ionic/app-scripts": "3.2.4",
"@ionic/lab": "1.0.24",
"@types/lodash": "4.14.55",
"cordova-browser": "^6.0.0",
"cordova-ios": "^6.1.1",
"cordova-plugin-androidx-adapter": "^1.1.3",
"cordova-plugin-datepicker": "^0.9.3",
"cordova-plugin-estimote": "git+https://github.com/evothings/phonegap-estimotebeacons.git",
"cordova.plugins.diagnostic": "^6.0.2",
"integrator-cordova-plugin-downloader": "^1.1.0",
"node-sass": "^4.14.1",
"typescript": "~2.4.2",
"web": "0.0.2"
},
"cordova": {
"plugins": {
"cordova-plugin-device": {},
"cordova-plugin-statusbar": {},
"ionic-plugin-keyboard": {},
"cordova-plugin-console": {},
"cordova-plugin-ble": {},
"cordova-plugin-whitelist": {},
"cordova-plugin-app-version": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-estimote": {},
"cordova-plugin-geolocation": {},
"cordova.plugins.diagnostic": {
"ANDROIDX_VERSION": "1.+"
},
"cordova-plugin-datepicker": {},
"cordova-plugin-wkwebviewxhrfix": {},
"cordova-plugin-camera": {},
"cordova-plugin-androidx-adapter": {},
"integrator-cordova-plugin-downloader": {}
},
"dependencies": {
"@angular/common": "^5.0.0",
"@angular/compiler": "^5.0.0",
"@angular/compiler-cli": "^5.0.0",
"@angular/core": "^5.0.0",
"@angular/forms": "^5.0.0",
"@angular/http": "^5.0.0",
"@angular/platform-browser": "^5.0.0",
"@angular/platform-browser-dynamic": "^5.0.0",
"@ionic-native/core": "^3.14.0",
"@ionic-native/estimote-beacons": "^3.12.1",
"@ionic-native/push": "^4.0.1",
"angular2-moment": "^1.3.0",
"com.unarin.cordova.beacon": "^3.4.0",
"connect": "^3.6.3",
"cordova-plugin-camera": "2.4.1",
"cordova-plugin-console": "1.0.7",
"cordova-plugin-crosswalk-webview": "2.3.0",
"cordova-plugin-device": "1.1.6",
"cordova-plugin-estimote": "git+https://github.com/evothings/phonegap-estimotebeacons.git",
"cordova-plugin-geolocation": "2.4.3",
"cordova-plugin-ibeacon": "3.4.0",
"cordova-plugin-splashscreen": "6.0.0",
"cordova-plugin-statusbar": "2.1.3",
"cordova-plugin-whitelist": "1.2.2",
"ionic-angular": "3.6.0",
"ionic-native": "2.4.1",
"ionic-plugin-keyboard": "2.2.1",
"ionicons": "3.0.0",
"lodash": "^4.17.4",
"moment": "^2.17.1",
"numeral": "^2.0.6",
"promise-polyfill": "6.0.2",
"rxjs": "5.1.1",
"sw-toolbox": "3.4.0",
"zone.js": "0.8.11"
},
"devDependencies": {
"@ionic/app-scripts": "^3.1.10",
"@types/lodash": "4.14.55",
"typescript": "^2.3.3"
},
"cordova": {
"plugins": {
"cordova-plugin-device": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-statusbar": {},
"cordova-plugin-whitelist": {},
"ionic-plugin-keyboard": {},
"com.unarin.cordova.beacon": {},
"cordova-plugin-estimote": {},
"cordova-plugin-geolocation": {},
"phonegap-plugin-push": {},
"cordova-plugin-crosswalk-webview": {
"XWALK_VERSION": "23+",
"XWALK_LITEVERSION": "xwalk_core_library_canary:17+",
"XWALK_COMMANDLINE": "--disable-pull-to-refresh-effect",
"XWALK_MODE": "embedded",
"XWALK_MULTIPLEAPK": "true"
},
"cordova-plugin-camera": {},
"cordova-plugin-console": {}
},
"platforms": [
"ios"
]
},
"platforms": [
"android",
"browser"
]
}

解为:ionic@3.17.0-alpha.3137c766

我也面临同样的问题。我通过在第三方API中添加http://来解决这个问题,如果它不适合他们,请尝试包含https://的http://

最新更新