Reputation: 310
I am running the following command for prod build
ng serve --prod --env=qa
after running this command i don't get any errors but once i run localhost:4200/
in the browser I get the following error
Uncaught Error: No provider for function (){}!
at b (core.es5.js:1169)
at core.es5.js:1207
at e._throwOrNull (core.es5.js:2649)
at e._getByKeyDefault (core.es5.js:2688)
at e._getByKey (core.es5.js:2620)
at e.get (core.es5.js:2489)
at dt (core.es5.js:9492)
at core.es5.js:9529
at pt (core.es5.js:9503)
at core.es5.js:9456
Any help would be appreciated
Upvotes: 2
Views: 1619
Reputation: 265
I know it's late but I had the same error and fixed it with this script (after npm install)
"npm-cleanup" : "rimraf ./node_modules/PACKAGE_WITH_ANGULAR_MODULES/node_modules"
in my package.json, by removing the node_modules of all packages with conflicting Angular versions.
Maybe it helps someone who is still struggling with this kind of error.
Upvotes: 1
Reputation: 586
I have a similar exception with this code block inside my app.module.ts
providers: [
...
CacheService,
{
provide: HttpCaching,
useFactory: httpFactory,
deps: [XHRBackend, RequestOptions, CacheService]
}
]
...
export function httpFactory(xhrBackend: XHRBackend, requestOptions: RequestOptions, cacheService: CacheService): Http {
return new HttpCaching(xhrBackend, requestOptions, cacheService);
}
It works great in development mode, but the injection of my CacheService fails when running it in production mode giving the Error: Uncaught (in promise): Error: No provider for function (){}!
Please let me know why we are getting this error.
Upvotes: 1