Components: Erorr in production after 6.0.1 - > 6.2.1:Cannot read property 'ngInjectableDef' of undefined

Created on 14 Jun 2018  路  14Comments  路  Source: angular/components

Bug, feature request, or proposal:

Bug

What is the expected behavior?

App should render and don't throw runtime error in production

What is the current behavior?

App throws error at runtime and app crashes

What are the steps to reproduce?

I just upgraded my app from 6.0.1 to 6.2.1, still not clue why this error appears - but revering back to 6.0.1 fixed it.

What is the use-case or motivation for changing an existing behavior?

Bugfix

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Angular 6.0.4
Material 6.2.1

Is there anything else we should know?

App worked in 6.0.1

Most helpful comment

I think deleting the node_modules and then running again npm install work, did it work for you @kdubious ?

All 14 comments

I also had problems when I switched from 6.02 to 6.21. In my case, it was this error:

ERROR Error: StaticInjectorError(AppModule)[MatSnackBarContainer -> MatSnackBarConfig]:
StaticInjectorError(Platform: core)[MatSnackBarContainer -> MatSnackBarConfig]:
NullInjectorError: No provider for MatSnackBarConfig!

This only happend in production mode, when the MatSnackBar should open. When using "ng serve" everything was fine.

I was almost getting crazy when I tried to find out what went wrong. Luckily reverting Angular Material to 6.02 helped. MatSnackBar is working again.

I really hope, it's okay to comment underneath this issue, as this problem seems quite similar to me.

Any updates?

@ScienceOfficer I would think your fix is to include MatSnackBarConfig in the providers node of your module.

For our issue, I'm stumped.

I'm getting it on Mouse Over of mat-menu-items in an expanded menu. Also getting it on certain routeLink clicks. My URLs are changing, but I get this error in the console, and nothing seems to load in the UI.

I saw the following Warnings (only a few listed below) during build, not sure if they are related:

WARNING in ./src/app/dashboard/dashboard.component.ngfactory.js
109:168-176 "export '傻f24' (imported as 'i13') was not found in '@angular/material/menu'

WARNING in ./node_modules/@angular/material/tabs/typings/index.ngfactory.js
121:77-95 "export 'ContentObserver' (imported as 'i3') was not found in '@angular/cdk/observers'

WARNING in ./node_modules/@angular/material/tabs/typings/index.ngfactory.js
154:77-95 "export 'ContentObserver' (imported as 'i3') was not found in '@angular/cdk/observers'

WARNING in ./src/app/app.component.ngfactory.js
158:3242-3250 "export '傻f24' (imported as 'i12') was not found in '@angular/material/menu'

Also, I'm at 6.0.5 with these errors (core) and CLI is "@angular/cli": "^6.0.8",

Reverted @angular/material to 6.0.1, have these warnings still:

WARNING in ./node_modules/@angular/material/tabs/typings/index.ngfactory.js
120:77-95 "export 'ContentObserver' (imported as 'i3') was not found in '@angular/cdk/observers'
WARNING in ./node_modules/@angular/material/tabs/typings/index.ngfactory.js
153:77-95 "export 'ContentObserver' (imported as 'i3') was not found in '@angular/cdk/observers'

And same error while running.

Reverted to "@angular/cdk": "^6.0.1" and no warnings.

Production works, but I have console errors:

ERROR TypeError: Cannot read property 'left' of undefined
at Object.updateRenderer (main.b7fe59c65462ae077399.js:1)
at Object.updateRenderer (main.b7fe59c65462ae077399.js:1)
at Ko (main.b7fe59c65462ae077399.js:1)
at ru (main.b7fe59c65462ae077399.js:1)
at nu (main.b7fe59c65462ae077399.js:1)
at Object.Ko [as checkAndUpdateView] (main.b7fe59c65462ae077399.js:1)
at e.detectChanges (main.b7fe59c65462ae077399.js:1)
at main.b7fe59c65462ae077399.js:1
at Array.forEach (<anonymous>)
at e.tick (main.b7fe59c65462ae077399.js:1)

I'm having the same issue after upgrade cdk to 6.2.1

main.js:1 ERROR TypeError: Cannot read property 'ngInjectableDef' of undefined
at Tr (main.js:1)
at t.get (main.js:1)
at vo (main.js:1)
at go (main.js:1)
at po (main.js:1)
at Wo (main.js:1)
at na (main.js:1)
at ta (main.js:1)
at Wo (main.js:1)
at na (main.js:1)

@theunreal thank you for the revert advice :)

Still happens after updating both angular/cdk and angular/material to 6.3.0

6.3.0 creates a new issue for me:
https://github.com/angular/material2/issues/11843#issue-333664697

This may solve it:
https://github.com/angular/material2/issues/11844#issuecomment-398496566

Mine seems OK now.

I think deleting the node_modules and then running again npm install work, did it work for you @kdubious ?

Yes, same package.json. Kill the @angular and rxjs folders and `npm install'. All good. Can probably close this.

Closing as the original report is not reproducible, feel free to open a new issue with a bit more information on how to reproduce the problem.

For the other issues being discussed in this thread, it looks like it is likely related to #11844

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings