Error: ionic starter using --ts | facade/promise.d.ts : Cannot re-export name that is not defined in the module

When creating an ionic2 project using --ts argument for typescript.

ionic start MyIonic2Tutorial tutorial --v2 --ts

I get this error when running ionic serve:

Hash: 8edd072d2ea2068f5bbd
Version: webpack 1.12.11
Time: 8110ms
Asset Size Chunks Chunk Names
app.bundle.js 2.73 MB 0 [emitted] main
[0] multi main 64 bytes {0} [built]
+ 365 hidden modules

ERROR in [default] /Users/hepi/Documents/dev/ionic2/MyIonic2Tutorial3/node_modules/angular2/src/facade/promise.d.ts:1:9
Cannot re-export name that is not defined in the module.

√ Webpack complete

It happens also when starting a project without the tutorial template.

I found this Angular issue:

And when changing the typescript version in package.js from 1.8.7 to 1.7.5,
it worked. I didn’t get the error, and the starter project runs.

1 Like

This error is caused by incompatibility between TypeScript and Angular and will be resolved with the next Ionic2 release (beta.4) because the master is already updated to Angular2 beta.8.

1 Like

I still get this error message with 2.0.0-beta.22

✗ TypeScript error: D:/Development/ionic/getting-started/node_modules/angular2/src/facade/promise.d.ts(1,10): Error TS2661: Cannot re-export name that is not defined in the module.

That’s the Ionic CLI version, not related to this issue. The key number is the Angular version. Look in package.json.

Ok - the Angular version is: 2.0.0-beta.6

"angular2": "2.0.0-beta.6",

And this issue was resolved in beta 7.

If you want to get rid of this error, you could either update the Ionic 2 framework to beta.4 or update only Angular 2 to beta.7 as @rapropos suggested.

Here is a good explanation of the difference (you can check out the linked post for more details):

I wrote a short guide on how to upgrade your project to beta.4 if you’re using an older version of the framework (check out the linked post for detailed instructions):

Can I just update Angular to the latest? 2.0.0-beta.14. Or will that not work with Ionic 2.0.0-beta.22? Sorry for my stupid question but I don’t know how tight Ionic and Angular are together. I guess they are recommend Angular version for each Ionic version.

I don’t understand your answer… I use the Ionic CLI 2.0.0-beta.22 version.

There are three things in play here: angular, ionic-angular, and the Ionic CLI. Let’s forget about the CLI for now, because it doesn’t affect this issue. ionic-angular does indeed recommend certain versions of angular. It’s not supported or recommended to use newer Angular versions (although personally I have been doing it without running into problems). That being said, ionic-angular beta 3 wants angular beta 6 and ionic-angular beta 4 wants angular beta 13. So if you update ionic-angular to beta 4 and angular to beta 13, you should be good to go.

Ionic CLI (currently 2.0.0-beta.24) is the command line interface of Ionic, e.g. the commands ionic start, ionic serve, ionic build, etc…

The Ionic Framework (currently 2.0.0-beta.4) is what is used for the actual building of apps, i.e. you add it as a dependency in the package.json of your app and then you can use its API and components.

So the error could be resolved by either updating the Ionic framework (not the CLI) to beta.4 or by updating Angular 2 to beta.7 or later (I would recommend the first option, as there are some important fixes made in beta.4).

@iignatov thanks a lot for your explanation! I had to update the following dependencies:

"angular2": "2.0.0-beta.13",   
"es6-shim": "^0.35.0",
"rxjs": "5.0.0-beta.2",
"zone.js": "^0.6.6"

And now it works fine! Thanks again!