(Ionic 2)尝试回退到Cordova-lib执行时发生错误:TypeError:无法读取未定义的属性'then' [英] (Ionic 2) An Error occurred trying to fall back to Cordova-lib execution: TypeError: Cannot read property 'then' of undefined
问题描述
编辑:当使用离子2时会发生这种情况。我知道它还不稳定,但我认为可能有一些修复,因为看起来其他人没有得到这个问题。 编辑结束
This is happening when working with ionic 2. I know it's not stable yet, but i assume that there may be some fix for this, since it seems like others don't get this problem. Edit end
出于某种原因,我在使用ionic build android尝试构建我的离子应用时突然开始出现此错误,以及ionic build ios:
For some reason i've suddenly started to get this error when trying to build my ionic app, using "ionic build android", and also "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)
我在这里迷路了,不知道从哪里开始寻找。
I'm lost here, and have no idea where to start looking.
以前是否有人见过这个,并且可以指出我正确的方向?
Is there anyone who has seen this before, and can point me in the right direction?
推荐答案
@mabs @mgcdanny
@mabs @mgcdanny
我很确定我已找出问题的根本原因。我跑了 cordova -v
并看到了这个输出 -
I am pretty certain I've figured out the root cause to the issue. I ran cordova -v
and saw this output -
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并且可以再次进行离子构建/准备。
Now I see cordova reporting it is at 6.0.0 and can do ionic build/prepare again.
我认为发生的事情是Ionic CLI认为没有安装cordova CLI。也许有可能在某个地方,Ionic CLI执行 cordova -v
并且因为读取〜/ .config / configstore的权限问题而被挂起/update-notifier-cordova.json
file。
I think what happened is that the Ionic CLI did not think that the cordova CLI was installed. Maybe it is possible that somewhere the Ionic CLI does a cordova -v
and was getting hung up by the permission issue reading the ~/.config/configstore/update-notifier-cordova.json
file.
这篇关于(Ionic 2)尝试回退到Cordova-lib执行时发生错误:TypeError:无法读取未定义的属性'then'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!