我使用以下命令将我的Angular 4应用程序更新到版本5:

npm install @angular/animations@'^5.0.0' @angular/common@'^5.0.0' @angular/compiler@'^5.0.0' @angular/compiler-cli@'^5.0.0' @angular/core@'^5.0.0' @angular/forms@'^5.0.0' @angular/http@'^5.0.0' @angular/platform-browser@'^5.0.0' @angular/platform-browser-dynamic@'^5.0.0' @angular/platform-server@'^5.0.0' @angular/router@'^5.0.0' typescript@2.4.2 rxjs@'^5.5.2'

npm install typescript@2.4.2 --save-exact

之后,我还执行了npm install和npm update命令 . 该应用程序与Angular 4工作正常,但现在我在浏览器控制台中看到此错误:

TypeError:worker_component_1未定义

错误细节(没有具体)

app.module.ts:18:35 ../../../../../src/app/app.module.ts http:// localhost:4200 / main.bundle.js:29: 1 webpack_require http:// localhost:4200 / inline.bundle.js:55:12 main.ts:4 ../../../../../src/main.ts http:// localhost: 4200 / main.bundle.js:366:1 webpack_require http:// localhost:4200 / inline.bundle.js:55:12 [0] http:// localhost:4200 / main.bundle.js:381:18 webpack_require http:// localhost:4200 / inline.bundle.js:55:12 webpackJsonpCallback http:// localhost:4200 / inline.bundle.js:26:23 http:// localhost:4200 / main.bundle.js:1 :1

没有编译错误或编辑 .

Package.json文件:

{
  "name": "angular",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
  "ng": "ng",
  "start": "ng serve",
  "build": "ng build",
  "test": "ng test",
  "lint": "ng lint",
  "e2e": "ng e2e"
  },
 "private": true,
 "dependencies": {
 "@angular/animations": "^5.0.0",
 "@angular/common": "^5.0.0",
 "@angular/compiler": "^5.0.0",
 "@angular/core": "^5.0.0",
 "@angular/forms": "^5.2.1",
 "@angular/http": "^5.2.1",
 "@angular/platform-browser": "^5.2.1",
 "@angular/platform-browser-dynamic": "^5.2.1",
 "@angular/platform-server": "^5.2.1",
 "@angular/router": "^5.2.1",
 "core-js": "^2.4.1",
 "jquery": "^3.3.0",
 "rxjs": "^5.5.6",
 "zone.js": "^0.8.20"
 },
"devDependencies": {
"@angular/cli": "^1.6.5",
"@angular/compiler-cli": "^5.2.1",
"@angular/language-service": "^4.4.6",
"@types/jasmine": "~2.5.53",
"@types/jasminewd2": "~2.0.2",
"@types/node": "~6.0.60",
"codelyzer": "^3.2.2",
"jasmine-core": "~2.6.2",
"jasmine-spec-reporter": "~4.1.0",
"karma": "~1.7.0",
"karma-chrome-launcher": "~2.1.1",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^1.3.3",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.1.2",
"ts-node": "~3.2.0",
"tslint": "~5.7.0",
"typescript": "^2.6.2"
}
}