ionic-framework: Getting : Uncaught TypeError: t.resolve is not a function
Ionic version: (check one with “x”) (For Ionic 1.x issues, please use https://github.com/ionic-team/ionic-v1) [ ] 2.x [ X ] 3.x [ ] 4.x
I’m submitting a … (check one with “x”) [ X ] bug report [ ] feature request
Current behavior:
When running ionic serve on the browser if I do a right click, I get the following :
polyfills.js:3 Uncaught TypeError: t.resolve is not a function
at Object.setNativePromise (polyfills.js:3)
at L.configurable.L.set (polyfills.js:3)
at new Synchronizetion (index.js:37)
at handleEvent (index.js:106)
at t.invokeTask (polyfills.js:3)
at r.runTask (polyfills.js:3)
at e.invokeTask [as invoke] (polyfills.js:3)
at p (polyfills.js:2)
at d (polyfills.js:2)
Expected behavior: It shouldn’t throw the error.
Steps to reproduce: Just do a right click and you’ll get the error.
Ionic info: (run ionic info from a terminal/cmd prompt and paste output below):
@ionic/cli-utils : 1.18.0
ionic (Ionic CLI) : 3.18.0
global packages:
cordova (Cordova CLI) : 7.0.1
local packages:
@ionic/app-scripts : 3.0.1
Cordova Platforms : android 6.2.3 ios 4.4.0
Ionic Framework : ionic-angular 3.8.0
System:
ios-deploy : 1.9.2
ios-sim : 6.0.0
Node : v8.1.3
npm : 5.4.2
OS : macOS Sierra
Xcode : Xcode 8.3.3 Build version 8E3004b
Environment Variables:
ANDROID_HOME : not set
Misc:
backend : legacy
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 5
- Comments: 32 (5 by maintainers)
@kensodemann HamzaLJ never got back to you, but I actually have the exact same issue with a project of mine. You can find a completely cut-down version of my project here. I’ve removed all of the typescript code except for the bare minimum initializations required to run into the error, in my own case.
I’m not sure if the error is in ionic (honestly, I don’t think so) but I’d personally appreciate it very much if somebody more experienced with this had a good idea of how to solve the issue properly.
After digging deep into it, I ended up looking at the es6.promise.js file module in core-js as that was part of the code that was transpiled into the polyfills.js file. Digging into it with the chrome debugger, I noticed that the .Resolve function of the Promise that Object.SetNativePromise was setting, (as the exception text correctly states) has .Resolve set to null. So I assume something goes wrong somewhere when doing polyfilling for Promise.
The way I ended up solving it temporarily for myself, was to comment out line 26 - 36 in es6.promise.js, the following lines:
which is the function that attempts to check if the Promise object has already been polyfilled by another library and instead, just replaced it with
var USE_NATIVE = true;.This is in no way a viable solution, but I just needed to get it work so I could get on with the test project.
The problem I run into now is the fact that I can’t get this to run on ionic’s build servers, because obviously I run into the same error there, since the Ionic build system uses the default implementations of the npm modules, as it should, so I’m once again stuck with this error.
Any good ideas as to how to solve it in a proper fashion?
Same problem here with ciscospark Browser SDK anyone has solved the problem?
A solution could be to inject the bundle directly in index.html of the ionic project. The bundle is generated through browserify.
had the same problem with mongodb-stitch played a lot with various settings and workarounds (different versions of angular, typescript, zone.js, custom fixes in zone.js lib)
the result is that I think there is currently no way to use it via npm, the only way was to add the
stitch.min.jsscript BEFORE polyfill.js in html, and afterwith
declare var stitch;at the topI am having the same problem. The problem started when I added the mongodb-stitch into the standard super starter pack. I just import " import { StitchClientFactory } from ‘mongodb-stitch’; in a provider.ts and nothing in app module or appcomponent.ts.