【发布时间】:2018-01-17 14:39:05
【问题描述】:
刚开始学习 ionic 3。ionic cordova build android 出现以下错误
(node:6364) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): [object Object]
(node:6364) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
以下是我的离子信息。
cli packages: (C:\Users\HIT\AppData\Roaming\npm\node_modules)
@ionic/cli-utils : 1.19.0
ionic (Ionic CLI) : 3.19.0
global packages:
cordova (Cordova CLI) : 8.0.0
local packages:
@ionic/app-scripts : 3.1.6
Cordova Platforms : none
Ionic Framework : ionic-angular 3.9.2
System:
Node : v8.5.0
npm : 5.3.0
OS : Windows 10
Environment Variables:
ANDROID_HOME : D:\AndroidSdk\platform-tools
Misc:
backend : pro
我在下面写了承诺代码
postData(credentials, type) {
return new Promise((resolve, reject) => {
let headers = new Headers();
this.http.post(apiUrl+type, JSON.stringify(credentials), {headers: headers})
.subscribe(res => {
resolve(res.json());
}, (err) => {
reject(err);
});
});
}
我在下面调用postData函数
signup(){
//Api connection
this.authService.postData(this.userData , "register.php").then((result) => {
this.reposeData = result;
console.log(this.reposeData);
localStorage.setItem('userData' , JSON.stringify(this.reposeData))
this.navCtrl.push(TabsPage);
}, (err) => {
//connection failed
});
}
这是我的代码问题吗?
【问题讨论】:
-
UnhandledPromiseRejectionWarning来自 Cordova,而不是来自您的代码。尝试使用--verbose参数进行构建,如果它提供了有关构建错误的更多信息,请使用 se。 -
如何使用-verbose @jcesarmobile
-
ionic cordova build android —verbose
-
--verbose not added to this project error @jcesarmobile
-
我不明白你最后的评论
标签: javascript cordova ionic3