首页 > 解决方案 > 关于架构验证的 Ng 构建错误

问题描述

我有一台 Node.JS 版本 12.18.3、全局角度 CLI 7.3.9 和角度 CLI 本地版本 6.2.9 的机器。

Package.Json 是

{
  "name": "xxxCo.PLA.Web",
  "version": "1.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "start:aot": "ng serve --aot",
    "build": "ng build --configuration=production",
    "build:dev": "ng build",
    "build:qa": "ng build --configuration=qa",
    "build:uat": "ng build --configuration=uat",
    "build:ssr": "npm run build --configuration=production --app=ssr --output-hashing=media",
    "build:aot": "ng build --aot",
    "test": "ng test --sourcemaps=false",
    "test:chrome": "ng test --sourcemaps=false --browser=Chrome",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "6.1.10",
    "@angular/cli": "6.2.9",
    "@angular/common": "6.1.10",
    "@angular/compiler": "6.1.10",
    "@angular/core": "^6.1.0",
    "@angular/forms": "6.1.10",
    "@angular/http": "^6.1.0",
    "@angular/platform-browser": "6.1.10",
    "@angular/platform-browser-dynamic": "6.1.10",
    "@angular/router": "6.1.10",
    "angular2-csv": "0.2.5",
    "auth0-js": "^9.7.3",
    "bootstrap": "^4.1.3",
    "classlist.js": "^1.1.20150312",
    "core-js": "^2.5.4",
    "font-awesome": "^4.7.0",
    "formdata-polyfill": "^3.0.11",
    "jquery": "^1.9.1",
    "lodash-es": "4.17.0",
    "moment": "^2.22.2",
    "ng-trim-value-accessor": "^2.0.4",
    "ngx-bootstrap": "^3.0.1",
    "ngx-cookie-service": "^1.0.10",
    "popper.js": "^1.14.3",
    "primeicons": "^1.0.0-beta.10",
    "primeng": "^6.1.2",
    "rxjs": "7.1.0",
    "rxjs-compat": "6.6.7",
    "web-animations-js": "^2.3.1",
    "zone.js": "~0.8.26"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "0.803.29",
    "@angular/compiler-cli": "6.1.10",
    "@angular/language-service": "^6.1.0",
    "@auth0/angular-jwt": "^2.0.0",
    "@types/auth0-js": "9.14.4",
    "@types/jasmine": "3.7.7",
    "@types/jasminewd2": "2.0.9",
    "@types/lodash-es": "4.17.4",
    "@types/node": "~8.9.4",
    "codelyzer": "~4.2.1",
    "jasmine-core": "~2.99.1",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~1.7.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",
    "less": "^3.0.4",
    "node-sass": "^4.9.3",
    "protractor": "~5.3.0",
    "ts-node": "8.10.2",
    "tslint": "6.1.3",
    "typescript": "2.9.2"
  }
}

并且基本上想对这个遗留应用程序进行小维护,并ng build排除以下所有这些错误:

node.exe : Your global Angular CLI version (7.3.9) is greater than your local
At C:\Users\MyUserName\AppData\Roaming\npm\ng.ps1:15 char:3
+   & "node$exe"  "$basedir/node_modules/@angular/cli/bin/ng" $args
+   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (Your global Ang...than your local:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError
 
version (6.2.9). The local Angular CLI version is used.

To disable this warning use "ng config -g cli.warnings.versionMismatch false".
Schema validation failed with the following errors:
  Data path ".builders['app-shell']" should have required property 'class'.
Error: Schema validation failed with the following errors:
  Data path ".builders['app-shell']" should have required property 'class'.
    at MergeMapSubscriber.project 
(C:\Dev\xxxCo.PLAPortal\Main\xxxCo.PLA\xxxCo.PLA.Web\ClientApp\node_modules\@angular\cli\node_modules\@angular-devkit\core\src\workspace\workspace.js:210:42)
    at MergeMapSubscriber._tryNext 
(C:\Dev\xxxCo.PLAPortal\Main\xxxCo.PLA\xxxCo.PLA.Web\ClientApp\node_modules\@angular\cli\node_modules\rxjs\internal\operators\mergeMap.js:65:27)
    at MergeMapSubscriber._next 
(C:\Dev\xxxCo.PLAPortal\Main\xxxCo.PLA\xxxCo.PLA.Web\ClientApp\node_modules\@angular\cli\node_modules\rxjs\internal\operators\mergeMap.js:55:18)
    at MergeMapSubscriber.Subscriber.next 
(C:\Dev\xxxCo.PLAPortal\Main\xxxCo.PLA\xxxCo.PLA.Web\ClientApp\node_modules\@angular\cli\node_modules\rxjs\internal\Subscriber.js:64:18)
    at MergeMapSubscriber.notifyNext 
(C:\Dev\xxxCo.PLAPortal\Main\xxxCo.PLA\xxxCo.PLA.Web\ClientApp\node_modules\@angular\cli\node_modules\rxjs\internal\operators\mergeMap.js:84:26)
    at InnerSubscriber._next (C:\Dev\xxxCo.PLAPortal\Main\xxxCo.PLA\xxxCo.PLA.Web\ClientApp\node_modules\@angular\cli\node_modules\rxjs\internal\InnerSubscriber.js:25:21)
    at InnerSubscriber.Subscriber.next 
(C:\Dev\xxxCo.PLAPortal\Main\xxxCo.PLA\xxxCo.PLA.Web\ClientApp\node_modules\@angular\cli\node_modules\rxjs\internal\Subscriber.js:64:18)
    at MapSubscriber._next (C:\Dev\xxxCo.PLAPortal\Main\xxxCo.PLA\xxxCo.PLA.Web\ClientApp\node_modules\@angular\cli\node_modules\rxjs\internal\operators\map.js:52:26)
    at MapSubscriber.Subscriber.next (C:\Dev\xxxCo.PLAPortal\Main\xxxCo.PLA\xxxCo.PLA.Web\ClientApp\node_modules\@angular\cli\node_modules\rxjs\internal\Subscriber.js:64:18)
    at SwitchMapSubscriber.notifyNext 
(C:\Dev\xxxCo.PLAPortal\Main\xxxCo.PLA\xxxCo.PLA.Web\ClientApp\node_modules\@angular\cli\node_modules\rxjs\internal\operators\switchMap.js:77:26)

有什么想法可以在这里获得干净的 ng 构建结果吗?非常感谢。

标签: node.jsangularnpm

解决方案


推荐阅读