gpt4 book ai didi

angular - 从 Angular 8 升级到 Angular 9 的问题

转载 作者:行者123 更新时间:2023-12-04 16:00:15 28 4
gpt4 key购买 nike

我正在按照 Angular's official updating guide 中的步骤操作,但是当我尝试查找时遇到了一个不会产生很多结果的问题。

更新完成后,我看到以下输出:

Your project has been updated to Angular version 9!
For more info, please see: https://v9.angular.io/guide/updating-to-version-9

当我跑 ng serve ,我得到这个输出:
Schema validation failed with the following errors:
Data path ".browserTarget" should match pattern "^[^:\s]+:[^:\s]+(:[^\s]+)?$".

angular.json ,我的服务配置是这样的:
    "serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "My Application:build"
},

这是我在 package.json 中的依赖项和 devDependencies :
"dependencies": {
"@angular-devkit/build-angular": "~0.900.0-rc.12",
"@angular-devkit/core": "^9.0.0-rc.12",
"@angular/animations": "^9.0.0-rc.12",
"@angular/cdk": "^9.0.0-rc.9",
"@angular/cli": "^9.0.0-rc.12",
"@angular/common": "^9.0.0-rc.12",
"@angular/compiler": "^9.0.0-rc.12",
"@angular/compiler-cli": "^9.0.0-rc.12",
"@angular/core": "^9.0.0-rc.12",
"@angular/flex-layout": "8.0.0-beta.27",
"@angular/forms": "^9.0.0-rc.12",
"@angular/material": "^9.0.0-rc.9",
"@angular/material-moment-adapter": "^9.0.0-rc.9",
"@angular/platform-browser": "^9.0.0-rc.12",
"@angular/platform-browser-dynamic": "^9.0.0-rc.12",
"@angular/platform-server": "^9.0.0-rc.12",
"@angular/router": "^9.0.0-rc.12",
"@angular/service-worker": "^9.0.0-rc.12",
"@busacca/ng-pick-datetime": "^8.0.1",
"@sentry/browser": "^5.4.0",
"@types/stripe": "^6.25.8",
"@w11k/ngx-componentdestroyed": "^4.1.4",
"angular-mentions": "^0.9.1",
"angular-token": "^7.0.1",
"angular2-actioncable": "^6.0.2",
"angular2-json2csv": "1.1.2",
"angular2-jsonapi": "^7.0.0",
"aws-sdk": "^2.493.0",
"browser-image-compression": "^1.0.6",
"calendar-utils": "0.0.7",
"convert-keys": "^1.3.4",
"core-js": "^2.4.1",
"d3": "^4.13.0",
"fs": "0.0.2",
"immutable": "~3.8.2",
"jshint": "^2.10.2",
"jspdf": "~1.4.1",
"jspdf-autotable": "~3.0.13",
"libphonenumber-js": "^1.7.24",
"lodash": "^4.17.13",
"logrocket": "^0.6.20",
"moment": "2.24.0",
"net": "^1.0.2",
"ng-intercom": "8.0.0",
"ng-sidebar": "~9.1.1",
"ng2-validation": "~4.2.0",
"ngx-image-compress": "^8.0.3",
"ngx-pipes": "~2.5.0",
"randomvin": "0.0.1",
"rxjs": "^6.5.4",
"saturn-datepicker": "^7.4.0",
"simple-web-notification": "^1.0.32",
"tls": "0.0.1",
"tslib": "^1.10.0",
"typescript": "~3.7.5",
"uuid": "~3.3.2",
"vin-generator": "^1.0.1",
"vin-validator": "^1.0.0",
"vindec-validator": "^1.1.3",
"weather-icons": "^1.3.2",
"webpack": "^4.29.6",
"xml2js": "^0.4.19",
"yargs": "^13.2.4",
"zone.js": "~0.10.2"
},
"devDependencies": {
"@angular/language-service": "^9.0.0-rc.12",
"@sentry/webpack-plugin": "^1.6.2",
"@types/jasmine": "^3.3.12",
"@types/node": "^12.11.1",
"codelyzer": "^5.1.2",
"husky": "^3.0.9",
"jasmine-core": "^3.3.0",
"jasmine-marbles": "^0.4.1",
"jasmine-reporters": "^2.3.2",
"jasmine-spec-reporter": "^4.2.1",
"karma": "^4.0.1",
"karma-chrome-launcher": "^2.2.0",
"karma-cli": "^2.0.0",
"karma-coverage-istanbul-reporter": "~2.0.5",
"karma-jasmine": "^2.0.1",
"karma-jasmine-html-reporter": "^1.4.0",
"karma-junit-reporter": "^1.2.0",
"karma-parallel": "^0.3.1",
"lint-staged": "^9.4.3",
"ng-bullet": "^1.0.3",
"prettier": "^1.19.1",
"protractor": "^5.4.2",
"protractor-screenshot-reporter": "0.0.5",
"rxjs-tslint": "^0.1.7",
"ts-node": "~8.0.3",
"tslint": "^5.20.1",
"tslint-config-prettier": "^1.18.0",
"tslint-plugin-prettier": "^2.0.1",
"webpack-bundle-analyzer": "^3.4.1",
"webpack-cyclic-dependency-checker": "0.0.1"
},

我一直无法找到有关为什么会发生这种情况的任何信息。我很想在这里得到一些帮助!

最佳答案

angular.json 中删除项目名称中的空格,并更新对项目名称的所有引用。因此,将“我的应用程序”随处替换为“我的应用程序”(仅使用对 javascript 中的标识符有效的字符,“空格”不是其中之一)。

...
"projects": {
"MyApplication": {
"projectType": "application",

...

"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "MyApplication:build"
},
"configurations": {
"production": {
"browserTarget": "MyApplication:build:production"
}
}
...

"defaultProject": "MyApplication"

等等...

关于angular - 从 Angular 8 升级到 Angular 9 的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59998140/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com