Error: You must pass in a NgModule or NgModuleFactory to be bootstrapped (with Server side rendering)

Viewed 594

I have migrated my app from angular 4 to angular 6. After It, after check all on client-side rendering, everything is ok with the app. But when I uploaded it on server ssh, I build the app on server side rendering and serves on server-side rendering. In the beginning, I have communicated: Node Express server listening on http://localhost:3000 And then I have error:

Error: You must pass in a NgModule or NgModuleFactory to be bootstrapped
    at View.engine (/home/portal/public_html/angular-6-15.04/ssr_project/dist/server.js:78843:23)
    at View.render (/home/portal/public_html/angular-6-15.04/ssr_project/dist/server.js:46683:8)
    at tryRender (/home/portal/public_html/angular-6-15.04/ssr_project/dist/server.js:44084:10)
    at Function.render (/home/portal/public_html/angular-6-.........

I don't know what to do. I tried to create angular bootstrapping manually (for example like here: https://blog.angularindepth.com/how-to-manually-bootstrap-an-angular-application-9a36ccf86429) But there is the same problem. Where is the problem?

https://blog.angularindepth.com/how-to-manually-bootstrap-an-angular-application-9a36ccf86429

https://medium.com/learnwithrahul/ways-of-bootstrapping-angular-applications-d379f594f604

 "serve:dynamic": "node dist/server"
  },
  "private": true,
  "dependencies": {
    "@agm/core": "^1.0.0-beta.5",
    "@angular-devkit/build-angular": "^0.10.7",
    "@angular/animations": "^6.1.10",
    "@angular/cdk": "^7.3.7",
    "@angular/common": "^6.1.10",
    "@angular/compiler": "^6.1.10",
    "@angular/core": "^6.1.10",
    "@angular/flex-layout": "^7.0.0-beta.24",
    "@angular/forms": "^6.1.10",
    "@angular/http": "^6.1.10",
    "@angular/platform-browser": "^6.1.10",
    "@angular/platform-browser-dynamic": "^6.1.10",
    "@angular/platform-server": "^6.1.10",
    "@angular/router": "^6.1.10",
    "@nguniversal/express-engine": "^6.1.0",
    "@nguniversal/module-map-ngfactory-loader": "^6.1.0",
    "@types/lodash": "^4.14.123",
    "angular-in-memory-web-api": "^0.8.0",
    "angular-tree-component": "8.0.0",
    "animate.css": "^3.7.0",
    "body-parser": "^1.18.3",
    "bootstrap": "^4.3.1",
    "cookie-parser": "^1.4.4",
    "core-js": "^2.6.5",
    "css-loader": "^1.0.1",
    "express": "^4.15.2",
    "font-awesome": "^4.7.0",
    "jquery": "^3.3.1",
    "moment": "^2.24.0",
    "morgan": "^1.9.1",
    "mydatepicker": "^1.10.2",
    "ng2-cache": "^0.2.1",
    "ng2-date-picker": "0.0.0",
    "ng2-datetime-picker": "^0.9.10",
    "ng2-nouislider": "^1.7.13",
    "ngx-bootstrap": "^2.0.0-beta.9-1",
    "ngx-cookie-service": "^1.0.10",
    "nouislider": "^9.2.0",
    "popper.js": "^1.14.7",
    "postcss-loader": "^3.0.0",
    "primeng": "^5.2.5",
    "rxjs": "6.4.0",
    "rxjs-compat": "^6.4.0",
    "xml2js": "^0.4.19",
    "zone.js": "^0.8.29"
  },
  "devDependencies": {
    "@angular/cli": "^6.2.9",
    "@angular/compiler-cli": "^6.1.10",
    "@angular/language-service": "^6.1.10",
    "@nicky-lenaers/ngx-scroll-to": "^1.1.1",
    "@types/file-saver": "0.0.1",
    "@types/node": "^8.10.44",
    "codelyzer": "0.0.28",
    "cpy-cli": "^1.0.1",
    "file-saver": "^1.3.8",
    "http-server": "^0.10.0",
    "jasmine-core": "2.4.1",
    "jasmine-spec-reporter": "2.5.0",
    "karma": "1.2.0",
    "karma-chrome-launcher": "^2.2.0",
    "karma-cli": "^1.0.1",
    "karma-jasmine": "^1.1.2",
    "karma-remap-istanbul": "^0.2.2",
    "lodash": "^4.17.11",
    "ng2-datepicker": "^2.3.1",
    "ng2-slideable-directive": "1.0.13",
    "ng2-slider-component": "1.0.9",
    "ng2-styled-directive": "1.0.5",
    "protractor": "4.0.9",
    "reflect-metadata": "^0.1.10",
    "rserv": "^1.1.3",
    "ts-loader": "^2.3.7",
    "ts-node": "1.2.1",
    "tslint": "3.13.0",
    "typescript": "^2.9.2",
    "webpack": "^4.29.6",
    "webpack-dev-server": "^3.2.1"
  }

@NgModule({
  declarations: [
      AppComponent,
      TreeView,
      AboutComponent,
      TreeViewDemo,
      ActionsComponent,
  AboutPageRecentActivityResultComponent,
  FolderItemComponent,
  FacetedFiltersComponent,
  FacetedSearchContainerComponet
....
],
  bootstrap: [AppComponent],
0 Answers
Related