cordova-plugin-tts
cordova-plugin-tts copied to clipboard
Uncaught TypeError: Cannot read property 'then' of undefined
I get this error with android. what could the problem be?
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.
I can confirm your solution worked (on iOS anyways).
- cordova plugin add cordova-plugin-tts
- copy https://github.com/vilic/cordova-plugin-tts/blob/master/www/tts.js to /plugins/cordova-plugins-tts/www/tts.js
- cordova platform rm ios
- cordova platform add ios
- npm run build-dev-cordova-ios
You could just add it right from github, like:
cordova plugins add https://github.com/vilic/cordova-plugin-tts.git