Search code examples
angularangular6universalserver-rendering

HttpInterceptingHandler is not a constructor while universal rendering angularjs 6


I'm trying to setup the server side rendering of my angular app, I have followed the instruction from here:

https://github.com/angular/angular-cli/wiki/stories-universal-rendering

Every command runs successfully, but after starting node server, when I try to visit the url, It throws the following error:

TypeError: _angular_common_http__WEBPACK_IMPORTED_MODULE_5__.ɵHttpInterceptingHandler is not a constructor
    at zoneWrappedInterceptingHandler (/Stuff/Development/Angular/angular-tuts/universal/dist/server.js:4040:23)
    at _callFactory (/Stuff/Development/Angular/angular-tuts/universal/dist/server.js:14256:20)
    at _createProviderInstance$1 (/Stuff/Development/Angular/angular-tuts/universal/dist/server.js:14210:26)
    at initNgModule (/Stuff/Development/Angular/angular-tuts/universal/dist/server.js:14143:32)
    at new NgModuleRef_ (/Stuff/Development/Angular/angular-tuts/universal/dist/server.js:14872:9)
    at Object.createNgModuleRef (/Stuff/Development/Angular/angular-tuts/universal/dist/server.js:14861:12)
    at NgModuleFactory_.create (/Stuff/Development/Angular/angular-tuts/universal/dist/server.js:17394:25)
    at /Stuff/Development/Angular/angular-tuts/universal/dist/server.js:9693:43
    at ZoneDelegate.invoke (/Stuff/Development/Angular/angular-tuts/universal/dist/server.js:515:26)
    at Object.onInvoke (/Stuff/Development/Angular/angular-tuts/universal/dist/server.js:9035:33)

Solution

  • Just Update your angular dependencies

    ng update @angular/core
    

    It will resolve the issue.