【问题标题】:(node:13606) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): [object Object] - Ionic Framework(节点:13606)UnhandledPromiseRejectionWarning:未处理的承诺拒绝(拒绝 id:1):[object Object] - 离子框架
【发布时间】:2018-12-20 17:01:39
【问题描述】:

我正在使用第三版的 Ionic 框架,当我运行 ionic cordova build --release android 时,我收到此错误:

(node:13791) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): [object Object]
(node:13791) [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.

关于此的其他线程并没有引导我到任何地方。请帮忙

【问题讨论】:

    标签: node.js ionic-framework ionic3


    【解决方案1】:

    我的第一次尝试是检查我的代码是否有未处理的承诺拒绝。

    如何检测未处理的承诺拒绝?

    假设我们有这样的代码:

    asyncAction.then(success => {
     // do stuff with the result of success
    })
    

    因此,如果 asyncActions 失败,则会出现未处理的 Promise 拒绝,因为我们永远不会捕获 Promise 的拒绝。为了捕捉拒绝,我们需要这样做:

    asyncAction.then(success => {
      // do stuff with the result of success
    }, rejection => {
    // handle action failed
    })
    

    【讨论】:

      【解决方案2】:

      我解决了将 cordova 版本降级到 7.1.0 的问题

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2019-04-16
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2019-02-24
        • 2018-01-18
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多