cordova - 'ECONNREFUSED' 对 http 请求
问题描述
我有一个迄今为止运行良好的 Ionic 应用程序,但是当我发出 http 请求时突然出现此错误。(通过运行“离子服务”,没有任何平台)。我想这与版本等问题有关。
错误:在 TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16) 处连接 ECONNREFUSED 127.0.0.1:8561
服务器工作正常并响应邮递员的请求。
这是包的详细信息:
- 离子-v 6.17.0
- 科尔多瓦-v 10.0.0
包.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"
]
}
解决方案
我也面临同样的问题。我通过在第三方 API 中添加 http:// 来解决问题,如果它对他们不起作用,请尝试包含 https:// instat of http://
推荐阅读
- python - Boto3 上传到 s3 存储桶
- cmd - 查找当前目录中所有包含“string1 string2”的文件*string*.dat
- excel - excel vba 2147221080 - 重新打开后端/数据工作簿的自动化错误
- alfresco - 运行 Alfresco 时出错“无法在此服务器上找到 Alfresco 存储库。”
- mongodb - 如何使用spring java mongo存储库做嵌入式文档
- go - Blitting FBO 颜色附件
- swift - Swift 协议行为
- python - pyqt5 组合框选定项与另一个窗口共享(信号/插槽)
- python - 未找到电子表格错误 - 尝试访问 Google 表格
- angular - Angular 8 Accordion,地图未显示