角度更新新版本错误:TypeError:对象原型可能只是一个Object或null:undefined

时间:2017-10-21 18:15:26

标签: angular

我使用webpack multi project generated files中的角度模板。所以在将角度版本4.1.2更新到4.4.6后,我猜服务器端预渲染是经纪的。它给出了错误:

  

Microsoft.AspNetCore.NodeServices.HostingModels.NodeInvocationException:由于错误导致预渲染失败:TypeError:对象原型可能只是一个Object或null:undefined       at setPrototypeOf(native)       在 extends(C:\ Users \ doom \ desktop \ emergency \ fso.web \ fso.angularclient \ ClientApp \ dist \ main-server.js:74339:5)       在C:\ Users \ doom \ desktop \ emergency \ fso.web \ fso.angularclient \ ClientApp \ dist \ main-server.js:74357:5       在C:\ Users \ doom \ desktop \ emergency \ fso.web \ fso.angularclient \ ClientApp \ dist \ main-server.js:74386:2       在Object.setPrototypeOf .__ proto (C:\ Users \ doom \ desktop \ emergency \ fso.web \ fso.angularclient \ ClientApp \ dist \ main-server.js:74313:10)       在Object.c(C:\ Users \ doom \ desktop \ emergency \ fso.web \ fso.angularclient \ ClientApp \ dist \ main-server.js:74316:2)       在 webpack_require (C:\ Users \ doom \ desktop \ emergency \ fso.web \ fso.angularclient \ ClientApp \ dist \ main-server.js:20:30)       at Object.setPrototypeOf。 proto (C:\ Users \ doom \ desktop \ emergency \ fso.web \ fso.angularclient \ ClientApp \ dist \ main-server.js:34187:203)       在对象。 (C:\ Users \用户末日\桌面\ feasion \ fso.web \ fso.angularclient \ ClientApp \ DIST \主server.js:34190:2)       在 webpack_require (C:\ Users \ doom \ desktop \ emergency \ fso.web \ fso.angularclient \ ClientApp \ dist \ main-server.js:20:30)   当前目录是:C:\ Users \ doom \ desktop \ emergency \ fso.web \ fso.angularclient

     

在   Microsoft.AspNetCore.NodeServices.HostingModels.HttpNodeInstance.d__7`1.MoveNext()   ---从抛出异常的先前位置开始的堆栈跟踪结束---

这是package.json

{


"name": "feasionangular",
  "version": "0.1.2",
  "scripts": {    
    "test": "karma start ClientApp/test/karma.conf.js"
  },
  "dependencies": {
    "@angular/animations": "4.4.6",
    "@angular/cdk": "^2.0.0-beta.10",
    "@angular/common": "4.4.6",
    "@angular/compiler": "4.4.6",
    "@angular/core": "4.4.6",
    "@angular/forms": "4.4.6",
    "@angular/http": "4.4.6",
    "@angular/platform-browser": "4.4.6",
    "@angular/platform-browser-dynamic": "4.4.6",
    "@angular/platform-server": "4.4.6",
    "@angular/router": "4.4.6",
    "@angular/material": "^2.0.0-beta.10",
    "@angular/flex-layout": "^2.0.0-beta.9",
    "@types/node": "7.0.18",
    "angular2-jwt": "0.2.3",
    "angular2-moment": "1.7.0",
    "angular2-template-loader": "0.6.2",
    "aspnet-prerendering": "^2.0.5",
    "aspnet-webpack": "^1.0.29",
    "awesome-typescript-loader": "3.1.3",
    "bootstrap": "3.3.7",
    "css": "2.2.1",
    "css-loader": "0.28.1",
    "es6-shim": "0.35.3",
    "event-source-polyfill": "0.0.9",
    "expose-loader": "0.7.3",
    "extract-text-webpack-plugin": "2.1.0",
    "file-loader": "0.11.1",
    "hammerjs": "2.0.8",
    "html-loader": "0.4.5",
    "isomorphic-fetch": "2.2.1",
    "json-loader": "0.5.4",
    "jsrsasign": "8.0.3",
    "ngx-bootstrap": "1.9.3",
    "ngx-carousel": "1.2.0",
    "ngx-infinite-scroll": "0.5.1",
    "normalize.css": "^7.0.0",
    "preboot": "4.5.2",
    "raw-loader": "0.5.1",
    "reflect-metadata": "0.1.10",
    "rxjs": "5.4.2",
    "style-loader": "0.17.0",
    "to-string-loader": "1.1.5",
    "typescript": "2.3.2",
    "tslint": "5.8.0",
    "url-loader": "0.5.8",
    "webpack": "2.5.1",
    "webpack-hot-middleware": "2.18.0",
    "webpack-merge": "4.1.0",
    "zone.js": "0.8.10"
  },
  "devDependencies": {
    "@types/chai": "3.5.2",
    "@types/jasmine": "2.5.47",
    "chai": "3.5.0",
    "jasmine-core": "2.6.1",
    "karma": "1.7.0",
    "karma-chai": "0.1.0",
    "karma-chrome-launcher": "2.1.1",
    "karma-cli": "1.0.1",
    "karma-jasmine": "1.1.0",
    "karma-webpack": "2.0.3"
  }
}

当我降级角度版本时,错误不会丢失,但我需要使用更新的版本。

2 个答案:

答案 0 :(得分:0)

您是否尝试升级其他软件包 " preboot":" 5.1.7", " rxjs":" 5.5.2",  "打字稿":" 2.6.1",

答案 1 :(得分:-1)

您可以更新@angular/compiler