将Angular项目从5x升级到6x后出现问题

时间:2019-02-08 10:53:59

标签: angular rxjs migration rxjs6 rxjs-compat

我已经按照常规指南将Angular 5项目升级到了6。我已经更新了软件包,还安装了rxjs-compat软件包,并运行以下命令从rxjs 5迁移到rxjs 6

npm install -g rxjs-tslint

npm install rxjs-compat --save

rxjs-5-to-6-migrate -p tsconfig.json

我的package.json如下

{
  "name": "srm-portal",
  "version": "1.0.0",
  "description": "",
  "main": "wwwroot/index.html",
  "author": "",
  "license": "ISC",
  "scripts": {
    "ngc": "ngc -p ./tsconfig-aot.json",
    "start": "concurrently \"webpack-dev-server --hot --inline --port 8080\" \"dotnet run\" ",
    "webpack-dev": "set NODE_ENV=development && webpack",
    "webpack-production": "set NODE_ENV=production && webpack",
    "build-dev": "npm run webpack-dev",
    "build-production": "npm run ngc && npm run webpack-production",
    "watch-webpack-dev": "set NODE_ENV=development && webpack --watch --color",
    "watch-webpack-production": "npm run build-production --watch --color",
    "publish-for-iis": "npm run build-production && dotnet publish -c Release"
  },
  "dependencies": {
    "@angular/animations": "^6.0.0",
    "@angular/common": "^6.0.0",
    "@angular/compiler": "^6.0.0",
    "@angular/compiler-cli": "^6.0.0",
    "@angular/core": "^6.0.0",
    "@angular/forms": "^6.0.0",
    "@angular/http": "^6.0.0",
    "@angular/platform-browser": "^6.0.0",
    "@angular/platform-browser-dynamic": "^6.0.0",
    "@angular/platform-server": "^6.0.0",
    "@angular/router": "^6.0.0",
    "@angular/upgrade": "~4.3.0",
    "angular-in-memory-web-api": "0.3.2",
    "angular2-chartjs": "^0.2.0",
    "angular2-notifications": "^0.7.4",
    "angular2-redux": "^4.0.0",
    "core-js": "2.5.6",
    "date-input-polyfill": "^2.14.0",
    "font-awesome": "4.7.0",
    "ie-shim": "~0.1.0",
    "linkifyjs": "^2.1.4",
    "ng2-appinsights": "^1.0.0-beta.1",
    "ng2-currency-mask": "^4.3.1",
    "ng2-dnd": "^4.2.0",
    "ng2-toasty": "^4.0.3",
    "ng2-validation": "^4.2.0",
    "ngx-chips": "1.5.3",
    "ngx-easy-table": "2.2.0",
    "ngx-pagination": "3.0.3",
    "powerbi-client": "^2.4.7",
    "primeicons": "^1.0.0-beta.10",
    "primeng": "^6.1.2",
    "redux": "^3.6.0",
    "redux-thunk": "^2.2.0",
    "reflect-metadata": "0.1.10",
    "rxjs": "^6.1.0",
    "rxjs-compat": "^6.4.0",
    "zone.js": "0.8.26"
  },
  "devDependencies": {
    "@types/node": "10.0.6",
    "angular-router-loader": "^0.6.0",
    "angular2-template-loader": "0.6.2",
    "awesome-typescript-loader": "3.1.2",
    "clean-webpack-plugin": "^0.1.16",
    "copy-webpack-plugin": "^4.0.1",
    "css-loader": "^0.28.0",
    "file-loader": "^0.11.1",
    "html-webpack-plugin": "^2.28.0",
    "json-loader": "^0.5.4",
    "node-sass": "^4.5.3",
    "raw-loader": "^0.5.1",
    "sass-loader": "^6.0.3",
    "source-map-loader": "^0.2.1",
    "style-loader": "^0.16.1",
    "ts-helpers": "^1.1.2",
    "tslint": "^5.1.0",
    "tslint-loader": "^3.5.2",
    "typescript": "2.7.2",
    "url-loader": "^0.5.8",
    "webpack": "^2.4.1",
    "webpack-dev-server": "2.4.2"
  },
  "-vs-binding": {
    "ProjectOpened": [
      "watch-webpack-dev"
    ]
  }
}

我正在使用Visual Studio 2017,并且错误列表中显示了许多错误

任何人都可以提供帮助和建议吗?

请参阅附件图片

Types.d.ts error http service api error

我的项目属性如下

Project Properties

1 个答案:

答案 0 :(得分:0)

我曾经遇到过类似的问题,因为我的角度应用程序是ASP.NET项目的一部分。在这个项目中,我也使用打字稿,但版本不同(较旧)。检查您的项目属性:enter image description here

我已在.csproj文件中添加了一个目标,以忽略我的角度应用程序目录中的打字稿。

  <Target Name="RemoveClientAppTsConfig" AfterTargets="FindConfigFiles">
    <ItemGroup>
      <ConfigFiles Remove="ClientApp/**" />
    </ItemGroup>
    <Message Importance="high" Text="remove all tsconfig.json under ClientApp" />
  </Target>

然后我在用于ASP.NET项目的tsconfig.json中(而不是在角度应用程序的tsconfig.json中)将有角度的应用程序(ClientApp)添加到排除项中。