将角度6升级到7到8

时间:2019-07-22 11:53:57

标签: angular

我正在尝试从Angular 6升级到Angular 7到Angular8。所以我更新了软件包和其他内容。新的Package.json文件如下所示

但是当我现在尝试npm start时。我收到此错误:

ERROR in Tried to overwrite C:/Source/nien/vital10-frontend/node_modules/ng2-dragula/dist/components/dragula.directive.d.ts.__ivy_ngcc_bak with an ngcc back up file, which is disallowed.
** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
i 「wdm」: Failed to compile.

好的,我的packackage.json文件现在看起来像这样:

{
  "name": "vital10-frontend",
  "version": "0.55.0",
  "license": "Unlicensed",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "hmr": "ng serve --configuration hmr",
    "build": "ng build",
    "build:prod": "npm run sass:prod && npm run vit10prod",
    "build:acc": "npm run sass:prod && npm run vit10acc",
    "build:test": "npm run sass:prod && npm run vit10test",
    "build:dev": "npm run sass:prod && npm run vit10dev",
    "test": "ng test",
    "test:cover": "ng test --code-coverage",
    "lint": "ng lint",
    "e2e": "ng e2e",
    "local": "ng serve -c local",
    "analyze-bundle": "webpack-bundle-analyzer dist/stats.json",
    "sass:watch": "sass --watch sass:src\\assets",
    "sass:prod": "sass --update -f --style compressed --sourcemap=none sass:src\\assets",
    "vit10dev": "ng build --prod -c vit10dev",
    "vit10test": "ng build --prod -c vit10test",
    "vit10acc": "ng build --prod -c vit10acc",
    "vit10prod": "ng build --prod -c production"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^8.1.2",
    "@angular/cdk": "^7.3.7",
    "@angular/common": "^8.1.2",
    "@angular/compiler": "^8.1.2",
    "@angular/core": "^8.1.2",
    "@angular/forms": "^8.1.2",
    "@angular/http": "^7.2.15",
    "@angular/platform-browser": "^8.1.2",
    "@angular/platform-browser-dynamic": "^8.1.2",
    "@angular/platform-server": "^8.1.2",
    "@angular/router": "^8.1.2",
    "@types/chart.js": "^2.7.54",
    "chart.js": "^2.7.2",
    "core-js": "^2.5.7",
    "jasmine": "^3.1.0",
    "ng2-charts": "^1.6.0",
    "ng2-dragula": "^2.1.1",
    "ng2-pdf-viewer": "^5.0.1",
    "node-sass": "^4.11.0",
    "oidc-client": "^1.5.1",
    "pdfjs-dist": "^2.0.489",
    "rxjs": "^6.5.2",
    "rxjs-compat": "^6.5.2",
    "web-animations-js": "^2.3.1",
    "zone.js": "^0.9.1"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^0.801.2",
    "@angular/cli": "^8.1.2",
    "@angular/compiler-cli": "^8.1.2",
    "@angular/language-service": "^8.1.2",
    "@angularclass/hmr": "^2.1.3",
    "@compodoc/compodoc": "^1.1.10",
    "@types/jasmine": "^3.3.14",
    "@types/node": "^12.6.8",
    "chai": "^4.1.2",
    "codelyzer": "^5.1.0",
    "convert-csv-to-json": "0.0.13",
    "cucumber": "^4.2.1",
    "cucumber-html-reporter": "^4.0.2",
    "cucumber-junit": "^1.7.1",
    "express-static": "^1.2.5",
    "jasmine-core": "^3.4.0",
    "jasmine-reporters": "^2.3.1",
    "jasmine-spec-reporter": "^4.2.1",
    "karma": "^4.2.0",
    "karma-chrome-launcher": "^3.0.0",
    "karma-cli": "^2.0.0",
    "karma-coverage-istanbul-reporter": "^1.2.1",
    "karma-html-reporter": "^0.2.7",
    "karma-jasmine": "^2.0.1",
    "karma-jasmine-html-reporter": "^1.4.2",
    "karma-junit-reporter": "^1.2.0",
    "karma-teamcity-reporter": "^1.1.0",
    "moment": "^2.22.1",
    "prettier": "1.13.4",
    "protractor": "^5.4.2",
    "protractor-beautiful-reporter": "^1.2.1",
    "protractor-cucumber-framework": "^5.0.0",
    "puppeteer": "^1.14.0",
    "request": "^2.87.0",
    "request-promise-native": "^1.0.5",
    "ts-node": "^3.3.0",
    "tslint": "^5.18.0",
    "tslint-angular": "^1.1.2",
    "typescript": "3.4.5",
    "webpack-bundle-analyzer": "^2.13.1",
    "xlsx": "^0.12.13"
  }
}

但随后出现此错误:

ERROR in ./node_modules/resolve/lib/sync.js
Module not found: Error: Can't resolve 'fs' in 'C:\Source\nien\vital10-frontend\node_modules\resolve\lib'
ERROR in ./node_modules/resolve/lib/async.js
Module not found: Error: Can't resolve 'fs' in 'C:\Source\nien\vital10-frontend\node_modules\resolve\lib'
ERROR in ./node_modules/resolve/lib/node-modules-paths.js
Module not found: Error: Can't resolve 'fs' in 'C:\Source\nien\vital10-frontend\node_modules\resolve\lib'
ERROR in ./node_modules/tslint/lib/utils.js
Module not found: Error: Can't resolve 'fs' in 'C:\Source\nien\vital10-frontend\node_modules\tslint\lib'
ERROR in ./node_modules/resolve/lib/sync.js
Module not found: Error: Can't resolve 'path' in 'C:\Source\nien\vital10-frontend\node_modules\resolve\lib'
ERROR in ./node_modules/resolve/lib/async.js
Module not found: Error: Can't resolve 'path' in 'C:\Source\nien\vital10-frontend\node_modules\resolve\lib'
ERROR in ./node_modules/resolve/lib/node-modules-paths.js
Module not found: Error: Can't resolve 'path' in 'C:\Source\nien\vital10-frontend\node_modules\resolve\lib'
ERROR in ./node_modules/source-map-support/source-map-support.js
Module not found: Error: Can't resolve 'path' in 'C:\Source\nien\vital10-frontend\node_modules\source-map-support'

我从tsconfig.json中注释了AngularCompilerOptions,如下所示:

{
  "compileOnSave": false,
  "compilerOptions": {
    "outDir": "./dist/out-tsc",
    "baseUrl": "src",
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "es5",
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2016",
      "dom"
    ]
  },
  // "angularCompilerOptions": {
  //   "enableIvy": true
  // }
}

但是还是红色错误。

如何运行该应用程序。现在的版本是:8.1.2。

但仍然会收到以下警告:

./ node_modules / typescript / lib / typescript.js 94814:19-45中的警告     关键依赖项:依赖项的请求是一个表达式

WARNING in ./node_modules/source-map-support/source-map-support.js
Module not found: Error: Can't resolve 'module' in 'C:\Source\nien\vital10-frontend\node_modules\source-map-support'
** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
i 「wdm」: Compiled with warnings.

如果我这样做:

  "angularCompilerOptions": {
     "enableIvy": true
   }
}

比我还不能编译。但是,如果我启用enableIvy,则为false。然后就可以了

0 个答案:

没有答案
相关问题