Updating @ionic/angular 6.0.0-rc.0 to rc.1 or rc.2 causes Angular compiler issue

For some reason every time I update my Ionic/angular 6.0 rc version, I keep getting weird compiler errors I’ve never seen-- Clearing node_modules and reinstalling doesn’t help.

The errors look like this, but it fills up the terminal window completely.

error TS2694: Namespace '"/Users/user/projects/myproject/node_modules/@angular/core/core"' has no exported member 'ɵɵInjectorDeclaration'.
[ng] 26     static ɵinj: i0.ɵɵInjectorDeclaration<IonicModule>;

I keep getting these error messages when trying to update by release candidate version from ^6.0.0-rc.0 to ^6.0.0-rc.2 (I tried at rc.1 as well and I had the same issue).

Here’s my angular version, I can successfully run rc.0 with no issues.

Angular CLI: 11.2.14
Node: 14.15.3
OS: darwin x64

Angular: 11.2.14
... cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Ivy Workspace: Yes

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.801.3
@angular-devkit/build-angular   0.1001.7
@angular-devkit/core            10.2.3
@angular-devkit/schematics      10.2.3
@schematics/angular             12.2.12
@schematics/update              0.1102.14
rxjs                            6.6.7
typescript                      4.0.8

Am I updating my release candidate version in a way that is causing this issue? I tried both npm update @ionic/angular and npm install @ionic/angular@next and both result in the same issue, where ionic serve simply doesn’t compile the application.

Ionic 6 is going to require Angular 12 or newer when it releases. Can you try updating to Angular 12 and see if that fixes the issue? (Just checked our breaking changes guide and it says Angular 11+ which is a typo. I will correct that now!)

1 Like

I’ve been trying to update to Angular 12 on the ionic project but have been running into peer dependency errors…

Running this:

npx @angular/cli@12 update @angular/core@12 @angular/cli@12

right now results in:

Package "@ionic/angular-toolkit" has an incompatible peer dependency to "@angular-devkit/architect" (requires "^0.1201.1", would install "0.1202.13").
✖ Migration failed: Incompatible peer dependencies found.
Peer dependency warnings when installing dependencies means that those dependencies might not work correctly together.

I made a post recently on the angular-toolkit repo about the issue and it was resolved in angular-toolkit@dist (5.0.0) (Incompatible peer dependency @angular-devkit/architect in Update for Angular from 11 to 12 in Ionic Project · Issue #460 · ionic-team/angular-toolkit · GitHub) but even when on angular-toolkit 5.0.0, I have the same issue, just different versions in the update error message.

What do you recommend here? I’ve been hesitant on forcing the update as I’m not sure what it may break.

Do you have a sample project that I could look at?

Ok, this should be taken care of as of @ionic/angular-toolkit@5.0.1

Ok I apparently had typescript@^4.3.5 listed as “dependencies” rather than “devDependencies” which caused ionic serve to result in an unsupported TS version error since Angular 12 installs typescript 4.4.4… anyway got that out of the way.

I was able to update to Angular 12 using @ionic/angular-toolkit@5.0.3 with zero issues. Now I am able to update to 6.0.0-rc.2 and it’s working!

Thanks for the help guys!

1 Like