将项目从角度4升级到6后无法运行项目

时间:2018-10-03 08:10:24

标签: angular npm

我将我的angular 4项目升级到了angular6。

在运行项目时遇到一个错误。

我搜索了类似的问题,但没有得到满意的答案。

 OpaqueToken is not a constructor.

我在这里附加我的package.json。

{

  "dependencies": {
    "@angular/animations": "6.1.9",
    "@angular/common": "6.1.9",
    "@angular/compiler": "6.1.9",
    "@angular/compiler-cli": "6.1.9",
    "@angular/core": "6.1.9",
    "@angular/forms": "6.1.9",
    "@angular/http": "6.1.9",
    "@angular/platform-browser": "6.1.9",
    "@angular/platform-browser-dynamic": "6.1.9",
    "@angular/platform-server": "6.1.9",
    "@angular/router": "6.1.9",
    "@angular/upgrade": "6.1.9",
    "@nguniversal/express-engine": "^6.1.0",
    "@nguniversal/module-map-ngfactory-loader": "^6.1.0",
    "angular-in-memory-web-api": "^0.3.1",
    "angular-pipes": "^6.5.3",
    "angular-sweetalert": "^1.1.2",
    "core-js": "^2.4.1",
    "ie-shim": "^0.1.0",
    "lodash": "^4.17.5",
    "ng2-file-upload": "^1.3.0",
    "ng2-meta": "^2.0.3",
    "ng2-select": "^2.0.0",
    "ng2-slugify": "^0.1.0",
    "ng2-vs-checklist": "0.0.1",
    "ngx-bootstrap": "^3.0.1",
    "ngx-owl-carousel": "^2.0.7",
    "ngx-sweetalert2": "^0.2.5",
    "reflect-metadata": "^0.1.9",
    "rxjs": "^6.3.3",
    "rxjs-compat": "^6.3.3",
    "script-loader": "^0.7.2",
    "sweetalert": "^2.1.0",
    "ts-loader": "^5.1.1",
    "zone.js": "~0.8.26"
  },


}

2 个答案:

答案 0 :(得分:4)

我通过更新ng2-meta@2.0.3解决了问题  使用OpaqueToken的软件包。也许在角度6中不兼容。

RewriteRule .? - [E=TYPO3_CONTEXT:Development]

答案 1 :(得分:1)

使用

  

InjectionToken

代替

  

OpaqueToken

Ex:-

// export const HTTP_FACTORY = new OpaqueToken("Http implementationfactory");

export const HTTP_FACTORY = new InjectionToken<HttpFactory>("Http implementation factory");