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