我已经升级了一个应用程序从角8到9版本。当我进行构建时,得到以下生成错误
构建命令: ng build --base-href /test/ --查看,ng build -base-href /test/ -prod

Package.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安装,但是得到了相同的错误。不知道我错过了什么,谁能帮帮吗?
发布于 2020-04-07 13:46:23
版本
发布于 2021-01-31 15:18:10
类型记录模块@type/jquery抛出一个错误,因为jquery不能很好地处理当前的类型记录版本。我们可以降级类型记录的版本,或者如果我们计划使用最新版本的类型记录,安装最新版本的@type/jquery将解决这个问题。
这两个简单的步骤对我有效。
rm -rf ./node_modules/@types/jquery
npm install @type/jquery3.5.5 // ( at this time typescript Version 4.1.3 you can opt for latest version @type/jquery3.5.5) https://stackoverflow.com/questions/61081320
复制相似问题