android – (Ionic 2)尝试回退到Cordova-lib执行时发生错误:TypeError:无法读取未定义的属性’then’

前端之家收集整理的这篇文章主要介绍了android – (Ionic 2)尝试回退到Cordova-lib执行时发生错误:TypeError:无法读取未定义的属性’then’前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
编辑:当使用离子2时会发生这种情况.我知道它还不稳定,但我认为可能有一些修复,因为似乎其他人没有得到这个问题.编辑结束

出于某种原因,我在尝试构建我的离子应用程序时突然开始出现此错误,使用“ionic build android”,以及“ionic build ios”:

An Error occurred trying to fall back to Cordova-lib execution: TypeError: Cannot read property 'then' of undefined
at Object.IonicTask.runCordova (/usr/local/lib/node_modules/ionic/lib/ionic/cordova.js:262:21)
at /usr/local/lib/node_modules/ionic/lib/ionic/cordova.js:142:19
at _fulfilled (/usr/local/lib/node_modules/ionic/node_modules/q/q.js:787:54)
at self.promiseDispatch.done (/usr/local/lib/node_modules/ionic/node_modules/q/q.js:816:30)
at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/ionic/node_modules/q/q.js:749:13)
at /usr/local/lib/node_modules/ionic/node_modules/q/q.js:557:44
at flush (/usr/local/lib/node_modules/ionic/node_modules/q/q.js:108:17)
at doNTCallback0 (node.js:430:9)
at process._tickCallback (node.js:359:13)

Error happened [TypeError: Cannot read property 'then' of undefined]
    TypeError: Cannot read property 'then' of undefined
at Object.IonicTask.runCordova (/usr/local/lib/node_modules/ionic/lib/ionic/cordova.js:262:21)
at /usr/local/lib/node_modules/ionic/lib/ionic/cordova.js:142:19
at _fulfilled (/usr/local/lib/node_modules/ionic/node_modules/q/q.js:787:54)
at self.promiseDispatch.done (/usr/local/lib/node_modules/ionic/node_modules/q/q.js:816:30)
at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/ionic/node_modules/q/q.js:749:13)
at /usr/local/lib/node_modules/ionic/node_modules/q/q.js:557:44
at flush (/usr/local/lib/node_modules/ionic/node_modules/q/q.js:108:17)
at doNTCallback0 (node.js:430:9)
at process._tickCallback (node.js:359:13)

我迷失在这里,不知道从哪里开始寻找.

有没有人以前见过这个,能指出我正确的方向吗?

解决方法

@mabs @mgcdanny

我很确定我已经找到问题的根本原因.我跑了cordova -v并看到了这个输出

Ross-MBP:test rossmartin$cordova -v
/usr/local/lib/node_modules/cordova/node_modules/update-notifier/node_modules/configstore/index.js:53
                throw err;
                ^

Error: EACCES: permission denied,open '/Users/rossmartin/.config/configstore/update-notifier-cordova.json'
You don't have access to this file.

然后我跑了

Ross-MBP:test rossmartin$sudo chown -R rossmartin ~/.config
Ross-MBP:test rossmartin$cordova -v
6.0.0

现在我看到cordova报告它在6.0.0并且可以再次进行离子构建/准备.

我认为发生的事情是Ionic CLI认为没有安装cordova CLI.也许有可能在某个地方Ionic CLI执行了cordova -v并且被读取〜/ .config / configstore / update-notifier-cordova.json文件的权限问题挂起了.

猜你在找的Android相关文章