cordova-plugin-tts icon indicating copy to clipboard operation
cordova-plugin-tts copied to clipboard

Uncaught TypeError: Cannot read property 'then' of undefined

Open desmeit opened this issue 5 years ago • 3 comments

I get this error with android. what could the problem be?

desmeit avatar Jun 04 '19 07:06 desmeit

I just downloaded and tried this and had the same issue and I resolved it.

First the problem. The JS in the plugin isn't returning a promise. That's why it's returning undefined.

Look at this file on your computer: plugins\cordova-plugin-tts\www\tts.js

You'll notice it's much different to what is on GitHub. So what I did was delete everything in my plugin folder, downloaded this right from GitHub and replaced the files in my folder. I then had to remove android as a platform and re-add it in order to clear out cordova's cache. Then I ran cordova run android and it worked.

So essentially the issue is that when you run "cordova plugin add cordova-plugin-tts" you get the wrong files.

asoap avatar Jul 31 '19 20:07 asoap

I can confirm your solution worked (on iOS anyways).

  1. cordova plugin add cordova-plugin-tts
  2. copy https://github.com/vilic/cordova-plugin-tts/blob/master/www/tts.js to /plugins/cordova-plugins-tts/www/tts.js
  3. cordova platform rm ios
  4. cordova platform add ios
  5. npm run build-dev-cordova-ios

markking79 avatar Jul 17 '20 07:07 markking79

You could just add it right from github, like:

cordova plugins add https://github.com/vilic/cordova-plugin-tts.git

Fever905 avatar Sep 15 '21 13:09 Fever905