首页 > 解决方案 > 将 Angular 8 更新为 9 时在 ../node_modules/@types/jquery/index.d.ts:8143:87 中构建错误

问题描述

我已将应用程序从 angular 8 升级到 9 版本。当我进行构建时出现以下构建错误

构建命令:ng build --base-href /test/ --watch,ng build --base-href /test/ --prod

在此处输入图像描述

包.json

{
  "name": "test",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^9.1.0",
    "@angular/common": "^9.1.0",
    "@angular/compiler": "^9.1.0",
    "@angular/core": "^9.1.0",
    "@angular/forms": "^9.1.0",
    "@angular/http": "^7.2.15",
    "@angular/localize": "^9.1.0",
    "@angular/platform-browser": "^9.1.0",
    "@angular/platform-browser-dynamic": "^9.1.0",
    "@angular/router": "^9.1.0",
    "@ng-bootstrap/ng-bootstrap": "^4.2.2",
    "@types/html2canvas": "0.0.33",
    "core-js": "^2.5.4",
    "html2canvas": "^1.0.0-alpha.12",
    "rxjs": "^6.5.5",
    "zone.js": "~0.10.3"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.803.12",
    "@angular/cli": "^9.1.0",
    "@angular/compiler-cli": "^9.1.0",
    "@angular/language-service": "^9.1.0",
    "@types/jasmine": "~2.8.6",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "~8.9.4",
    "codelyzer": "^5.0.1",
    "jasmine-core": "~2.99.1",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "^4.4.1",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.0",
    "karma-jasmine": "~1.1.1",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "^6.0.0",
    "ts-node": "~5.0.1",
    "tslint": "~5.9.1",
    "typescript": "~3.8.3"
  }
}

tsconfig.json

{
  "compileOnSave": false,
  "compilerOptions": {
    "baseUrl": "./",
    "downlevelIteration": true,
    "module": "esnext",
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "es2015",
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2017",
      "dom"
    ]
  }
}

角度 cli 版本:9.1.0,节点 js 版本:12.16.1,

我无法构建应用程序,我还尝试删除 node_modules 文件夹并执行 npm install 但得到相同的错误。不知道我错过了什么,有人可以帮忙吗

标签: angularangular-cli

解决方案


  1. 您是否尝试在 tsconfig 的 compilerOptions 中将“skipLibCheck”设置为 true?
  2. 尝试将您的打字稿包降级到版本 3.5.3

推荐阅读