Angular material 6.3.0 stop to work on build prod
See original GitHub issueBug, feature request, or proposal:
Stop to working on:
ng serve --prod
in ng serve work well
The application start with this error:
main.3cea331738aacf3015b8.js:1 ERROR Error: StaticInjectorError(Os)[t -> t]:
StaticInjectorError(Platform: core)[t -> t]:
NullInjectorError: No provider for t!
at t.get (main.3cea331738aacf3015b8.js:1)
at main.3cea331738aacf3015b8.js:1
at t (main.3cea331738aacf3015b8.js:1)
at t.get (main.3cea331738aacf3015b8.js:1)
at main.3cea331738aacf3015b8.js:1
at t (main.3cea331738aacf3015b8.js:1)
at t.get (main.3cea331738aacf3015b8.js:1)
at bi (main.3cea331738aacf3015b8.js:1)
at t.get (main.3cea331738aacf3015b8.js:1)
at so (main.3cea331738aacf3015b8.js:1)
le @ main.3cea331738aacf3015b8.js:1
main.3cea331738aacf3015b8.js:1 Error: StaticInjectorError(Os)[t -> t]:
StaticInjectorError(Platform: core)[t -> t]:
NullInjectorError: No provider for t!
at t.get (main.3cea331738aacf3015b8.js:1)
at main.3cea331738aacf3015b8.js:1
at t (main.3cea331738aacf3015b8.js:1)
at t.get (main.3cea331738aacf3015b8.js:1)
at main.3cea331738aacf3015b8.js:1
at t (main.3cea331738aacf3015b8.js:1)
at t.get (main.3cea331738aacf3015b8.js:1)
at bi (main.3cea331738aacf3015b8.js:1)
at t.get (main.3cea331738aacf3015b8.js:1)
at so (main.3cea331738aacf3015b8.js:1)
main.3cea331738aacf3015b8.js:1 ERROR TypeError: Cannot read property 'instance' of undefined
at Li (main.3cea331738aacf3015b8.js:1)
at Object.handleEvent (main.3cea331738aacf3015b8.js:1)
at Object.handleEvent (main.3cea331738aacf3015b8.js:1)
at Object.handleEvent (main.3cea331738aacf3015b8.js:1)
at Br (main.3cea331738aacf3015b8.js:1)
at main.3cea331738aacf3015b8.js:1
at main.3cea331738aacf3015b8.js:1
at e.invokeTask (polyfills.7a0e6866a34e280f48e7.js:1)
at Object.onInvokeTask (main.3cea331738aacf3015b8.js:1)
at e.invokeTask (polyfills.7a0e6866a34e280f48e7.js:1)
le @ main.3cea331738aacf3015b8.js:1
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
Angular CLI: 6.0.7
Node: 10.3.0
OS: win32 x64
Angular: 6.0.5
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.6.8
@angular-devkit/build-angular 0.6.8
@angular-devkit/build-optimizer 0.6.8
@angular-devkit/core 0.6.8
@angular-devkit/schematics 0.7.0-beta.1
@angular/cdk 6.3.0
@angular/flex-layout 6.0.0-beta.16
@angular/material 6.3.0
@ngtools/webpack 6.0.8
@schematics/angular 0.6.7 (cli-only)
@schematics/update 0.6.7 (cli-only)
rxjs 6.2.1
typescript 2.7.2
webpack 4.8.3
Is there anything else we should know?
if i try:
ng serve --prod --optimization=false
Give me this error:
ERROR Error: StaticInjectorError(AppModule)[AppComponent -> MatSnackBar]:
StaticInjectorError(Platform: core)[AppComponent -> MatSnackBar]:
NullInjectorError: No provider for MatSnackBar!
at NullInjector.push../node_modules/@angular/core/fesm5/core.js.NullInjector.get (main.1671513801bff42a5980.js:31078)
at resolveToken (main.1671513801bff42a5980.js:31328)
at tryResolveToken (main.1671513801bff42a5980.js:31273)
at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (main.1671513801bff42a5980.js:31168)
at resolveToken (main.1671513801bff42a5980.js:31328)
at tryResolveToken (main.1671513801bff42a5980.js:31273)
at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (main.1671513801bff42a5980.js:31168)
at resolveNgModuleDep (main.1671513801bff42a5980.js:38109)
at NgModuleRef_.push../node_modules/@angular/core/fesm5/core.js.NgModuleRef_.get (main.1671513801bff42a5980.js:38801)
at resolveDep (main.1671513801bff42a5980.js:39167)
defaultErrorLogger @ main.1671513801bff42a5980.js:31671
push../node_modules/@angular/core/fesm5/core.js.ErrorHandler.handleError @ main.1671513801bff42a5980.js:31719
(anonymous) @ main.1671513801bff42a5980.js:34368
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke @ polyfills.f506ff5bbe08fb3ba254.js:2710
push../node_modules/zone.js/dist/zone.js.Zone.run @ polyfills.f506ff5bbe08fb3ba254.js:2460
push../node_modules/@angular/core/fesm5/core.js.NgZone.runOutsideAngular @ main.1671513801bff42a5980.js:33739
(anonymous) @ main.1671513801bff42a5980.js:34368
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke @ polyfills.f506ff5bbe08fb3ba254.js:2710
onInvoke @ main.1671513801bff42a5980.js:33780
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke @ polyfills.f506ff5bbe08fb3ba254.js:2709
push../node_modules/zone.js/dist/zone.js.Zone.run @ polyfills.f506ff5bbe08fb3ba254.js:2460
(anonymous) @ polyfills.f506ff5bbe08fb3ba254.js:3194
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask @ polyfills.f506ff5bbe08fb3ba254.js:2743
onInvokeTask @ main.1671513801bff42a5980.js:33771
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask @ polyfills.f506ff5bbe08fb3ba254.js:2742
push../node_modules/zone.js/dist/zone.js.Zone.runTask @ polyfills.f506ff5bbe08fb3ba254.js:2510
drainMicroTaskQueue @ polyfills.f506ff5bbe08fb3ba254.js:2917
Promise.then (async)
scheduleMicroTask @ polyfills.f506ff5bbe08fb3ba254.js:2900
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.scheduleTask @ polyfills.f506ff5bbe08fb3ba254.js:2732
onScheduleTask @ polyfills.f506ff5bbe08fb3ba254.js:2619
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.scheduleTask @ polyfills.f506ff5bbe08fb3ba254.js:2723
push../node_modules/zone.js/dist/zone.js.Zone.scheduleTask @ polyfills.f506ff5bbe08fb3ba254.js:2554
push../node_modules/zone.js/dist/zone.js.Zone.scheduleMicroTask @ polyfills.f506ff5bbe08fb3ba254.js:2574
scheduleResolveOrReject @ polyfills.f506ff5bbe08fb3ba254.js:3184
ZoneAwarePromise.then @ polyfills.f506ff5bbe08fb3ba254.js:3284
push../node_modules/@angular/core/fesm5/core.js.ApplicationInitStatus.runInitializers @ main.1671513801bff42a5980.js:33034
(anonymous) @ main.1671513801bff42a5980.js:34273
_callAndReportToErrorHandler @ main.1671513801bff42a5980.js:34365
(anonymous) @ main.1671513801bff42a5980.js:34271
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke @ polyfills.f506ff5bbe08fb3ba254.js:2710
onInvoke @ main.1671513801bff42a5980.js:33780
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke @ polyfills.f506ff5bbe08fb3ba254.js:2709
push../node_modules/zone.js/dist/zone.js.Zone.run @ polyfills.f506ff5bbe08fb3ba254.js:2460
push../node_modules/@angular/core/fesm5/core.js.NgZone.run @ main.1671513801bff42a5980.js:33694
push../node_modules/@angular/core/fesm5/core.js.PlatformRef.bootstrapModuleFactory @ main.1671513801bff42a5980.js:34262
./src/main.ts @ main.1671513801bff42a5980.js:207374
__webpack_require__ @ runtime.8c26f1fab6959b00a997.js:77
0 @ main.1671513801bff42a5980.js:207388
__webpack_require__ @ runtime.8c26f1fab6959b00a997.js:77
checkDeferredModules @ runtime.8c26f1fab6959b00a997.js:44
webpackJsonpCallback @ runtime.8c26f1fab6959b00a997.js:31
(anonymous) @ main.1671513801bff42a5980.js:1
main.1671513801bff42a5980.js:207375 Error: StaticInjectorError(AppModule)[AppComponent -> MatSnackBar]:
StaticInjectorError(Platform: core)[AppComponent -> MatSnackBar]:
NullInjectorError: No provider for MatSnackBar!
at NullInjector.push../node_modules/@angular/core/fesm5/core.js.NullInjector.get (main.1671513801bff42a5980.js:31078)
at resolveToken (main.1671513801bff42a5980.js:31328)
at tryResolveToken (main.1671513801bff42a5980.js:31273)
at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (main.1671513801bff42a5980.js:31168)
at resolveToken (main.1671513801bff42a5980.js:31328)
at tryResolveToken (main.1671513801bff42a5980.js:31273)
at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (main.1671513801bff42a5980.js:31168)
at resolveNgModuleDep (main.1671513801bff42a5980.js:38109)
at NgModuleRef_.push../node_modules/@angular/core/fesm5/core.js.NgModuleRef_.get (main.1671513801bff42a5980.js:38801)
at resolveDep (main.1671513801bff42a5980.js:39167)
The same code work well with old version.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:10
- Comments:28 (9 by maintainers)
Top Results From Across the Web
Resolve version conflicts when adding Angular Material to an ...
I am working on an Ionic angular project. I'm trying to add Angular Material to use some of the included prebuilt UI components...
Read more >Guide to update your Angular application v6.0 -> v12.0 for ...
Update to the new version ... Review these changes and perform the actions to update your application. If you use the Angular Service...
Read more >angular component (material) not recognized in IDE (but ...
Found 43 dependencies. We analyzed your package.json and everything seems to be in order. Good work!` One thing that could be related is...
Read more >Upgrade to Angular 14 - Techiediaries
Use the ng update command of the Angular CLI ... many new features for the core framework and the other libraries like Angular...
Read more >Angular-CLI and NW.js for development - DEV Community
Step 3: Adding in NW.js · Kill the local webserver you had running · npm install --save-dev nw@sdk concurrently · Open the package.json...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Deleting
./node_modules/
and reinstalling it fixed it for me (again). So, try that first before you change package versions.Can anyone answer whether the issue goes away if you update
@angular/cli
and@angular-devkit/build-angular
to the latest versions?