Conflict with @types/es6-promise cause crash on build


#1

Hello everyone,

First of all, It doesn’t concern only Ionic2, but this happened when I npm-installed superlogin-client and tried to use it,

superlogin-client has the depedency “@types/es6-promise”, but ionic use typescript/lib/lib.es2015.iterable.d.ts. And they don’t go well together.

So I writed this code in src/app/app.component.ts, and I had error on “ionic serve” and “ionic build browser”.

import superlogin from "superlogin-client"

Here is the error when you try “ionic build browser”,

[04:14:34]  Error: Error at C:/xampp/htdocs/JS Projects/Ionic                                            
            Projects/onthemove/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts:164:11       
[04:14:34]  Duplicate identifier 'Promise'.                                                              
[04:14:34]  Error at C:/xampp/htdocs/JS Projects/Ionic                                                   
            Projects/onthemove/node_modules/typescript/lib/lib.es2015.promise.d.ts:20:11                 
[04:14:34]  Duplicate identifier 'Promise'.                                                              
[04:14:34]  Error at C:/xampp/htdocs/JS Projects/Ionic                                                   
            Projects/onthemove/node_modules/typescript/lib/lib.es2015.promise.d.ts:187:13                
[04:14:34]  Duplicate identifier 'Promise'.                                                              
[04:14:34]  Error at C:/xampp/htdocs/JS Projects/Ionic                                                   
            Projects/onthemove/node_modules/typescript/lib/lib.es2015.iterable.d.ts:141:11               
[04:14:34]  Duplicate identifier 'Promise'.                                                              
[04:14:34]  Error at C:/xampp/htdocs/JS Projects/Ionic                                                   
            Projects/onthemove/node_modules/@types/es6-promise/index.d.ts:11:15                          
[04:14:34]  Duplicate identifier 'Promise'.                                                              
[04:14:34]  Error at C:/xampp/htdocs/JS Projects/Ionic                                                   
            Projects/onthemove/node_modules/@types/es6-promise/index.d.ts:42:19                          
[04:14:34]  Duplicate identifier 'Promise'.                                                              
[04:14:34]  ngc failed                                                                                   
[04:14:34]  ionic-app-script task: "build"                                                               
[04:14:34]  Error: Error                  

So the solution was to “npm uninstall @types/es6-promise”, and the plugin worked, but is there a way to say “hey don’t install @types/es6-promise” ?

PS : I struggled to have those errors because when I did “ionic serve” I had the error “indexOf of undefined”, so for the beginners like me, try “ionic build [platform]” to have the full stack error :blush:


#2

That project should simply not declare @types/es6-promise as a dependency. If anything it should be a devDependency. Looks like there’s already an open issue for this: micky2be/superlogin-client#31


#3

Thank you for your explaination, you’re right, it’s the project’s fault, so i’ll move to the superlogin github repo.

I just wanted to share my experience, so people won’t struggle on that :slight_smile:


#4

Hello can you help me on how to use sperlogin-client and keep user logged in after page refresh? If you have a source code I can really appreciate. Thank you