(Ionic 2) An error occurred while trying to return to execution Cordoba-lib: TypeError: Unable to read the "then" property from undefined

Edit: This happens when working with ionic 2. I know that it is not stable yet, but I suppose there might be some correction for this, as it seems that others are not getting this problem. Change end

For some reason, I suddenly started getting this error when trying to create my ionic app using the "Android ion collector" as well as the "ios ion collector":

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 got 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?

+7
android ios ionic-framework ionic2
source share
4 answers

@mabs @mgcdanny

I am sure that I understood the cause of this problem. 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. 

Then i ran

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

Now I see that the cordova reports that it is at 6.0.0 and can run the ion assembly / preparation again and again.

I think it happened that the Ionic CLI did not think the CLI was installed. It is possible, perhaps, that somewhere the Ionic CLI does cordova -v and depends on a resolution problem reading the ~/.config/configstore/update-notifier-cordova.json .

+6
source share

I had the same issue on Ubuntu.

I needed to install several dependencies.

Firstly, Cordoba, with:

 npm install -g cordova 

Android SDK from http://developer.android.com/sdk/index.html

And the Java SDK.

+5
source share

delete globally (use sudo if necessary)

 sudo npm uninstall -g ionic sudo npm uninstall -g ionic@beta sudo npm uninstall -g cordova 

set permissions as: https://docs.npmjs.com/getting-started/fixing-npm-permissions

this worked for me:

 sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share} 

reinstall (without sudo)

 npm install -g ionic npm install -g ionic@beta 
+3
source share

The build process was looking for Cordoba-lib and could not find it. This usually happens if you did not install the Cordoval-CLI.

To check if your cordova-CLI is installed, enter $ ionic info Check the result. if you see the Cordoba CLI: the npm start is not installed install -g cordova@4.2.0 $ ionic info > it should display the Cordoba CLI: 4.2.0

0
source share

All Articles