简体   繁体   中英

Data path ".builders['app-shell']" should have required property 'class'. 2020 Update

Have tried every single option in StackOverflow forums and others, no luck.

Tried and Didn't work
npm uninstall @angular-devkit/build-angular
npm cache clean -f
npm install @angular-devkit/build-angular

Deleted the node_modules folder and ran npm install, did not work

Have tried to uninstall and install @angular-cli

Most answers are from last year or with a much older version of angular that I am using. Please advise

While trying to deploy using build --prod these are the errors I am getting

 Schema validation failed with the following errors:
    2020-10-13 05:17:31 pm 0 ms output Data path ".builders['app-shell']" should have required property 'class'.
    2020-10-13 05:17:31 pm 2 ms output Error: Schema validation failed with the following errors:
    2020-10-13 05:17:31 pm 0 ms output Data path ".builders['app-shell']" should have required property 'class'.
    2020-10-13 05:17:31 pm 1 ms output at MergeMapSubscriber._registry.compile.pipe.operators_1.concatMap.validatorResult [as project] (/usr/local/lib/node_modules/@angular/cli/node_modules/@angular-devkit/core/src/workspace/workspace.js:215:42)
    2020-10-13 05:17:31 pm 0 ms output at MergeMapSubscriber._tryNext (/usr/local/lib/node_modules/@angular/cli/node_modules/rxjs/internal/operators/mergeMap.js:69:27)
    2020-10-13 05:17:31 pm 0 ms output at MergeMapSubscriber._next (/usr/local/lib/node_modules/@angular/cli/node_modules/rxjs/internal/operators/mergeMap.js:59:18)
    2020-10-13 05:17:31 pm 1 ms output at MergeMapSubscriber.Subscriber.next (/usr/local/lib/node_modules/@angular/cli/node_modules/rxjs/internal/Subscriber.js:67:18)
    2020-10-13 05:17:31 pm 0 ms output at MergeMapSubscriber.notifyNext (/usr/local/lib/node_modules/@angular/cli/node_modules/rxjs/internal/operators/mergeMap.js:92:26)
    2020-10-13 05:17:31 pm 0 ms output at InnerSubscriber._next (/usr/local/lib/node_modules/@angular/cli/node_modules/rxjs/internal/InnerSubscriber.js:28:21)
    2020-10-13 05:17:31 pm 1 ms output at InnerSubscriber.Subscriber.next (/usr/local/lib/node_modules/@angular/cli/node_modules/rxjs/internal/Subscriber.js:67:18)
    2020-10-13 05:17:31 pm 0 ms output at MapSubscriber._next (/usr/local/lib/node_modules/@angular/cli/node_modules/rxjs/internal/operators/map.js:55:26)
    2020-10-13 05:17:31 pm 0 ms output at MapSubscriber.Subscriber.next (/usr/local/lib/node_modules/@angular/cli/node_modules/rxjs/internal/Subscriber.js:67:18)
    2020-10-13 05:17:31 pm 1 ms output at SwitchMapSubscriber.notifyNext (/usr/local/lib/node_modules/@angular/cli/node_modules/rxjs/internal/operators/switchMap.js:86:26)
    2020-10-13 05:17:31 pm 0 ms output at Inner Subscriber. Next (/usr/local/lib/node_modules/@angular/cli/node_modules/rxjs/internal/InnerSubscriber.js:28:21)
    2020-10-13 05:17:31 pm 0 ms output at InnerSubscriber.Subscriber.next (/usr/local/lib/node_modules/@angular/cli/node_modules/rxjs/internal/Subscriber.js:67:18)
    2020-10-13 05:17:31 pm 1 ms output at /usr/local/lib/node_modules/@angular/cli/node_modules/rxjs/internal/util/subscribeTo.js:17:28
    2020-10-13 05:17:31 pm 0 ms output at Object.subscribeToResult (/usr/local/lib/node_modules/@angular/cli/node_modules/rxjs/internal/util/subscribeToResult.js:10:45)
    2020-10-13 05:17:31 pm 1 ms output at SwitchMapSubscriber. Inner Sub (/usr/local/lib/node_modules/@angular/cli/node_modules/rxjs/internal/operators/switchMap.js:65:54)
    2020-10-13 05:17:31 pm 0 ms output at SwitchMapSubscriber. Next (/usr/local/lib/node_modules/@angular/cli/node_modules/rxjs/internal/operators/switchMap.js:55:14)
    2020-10-13 05:17:31 pm 1 ms output Post-launch commands failed, but the current application symlink was updated.
    2020-10-13 05:17:31 pm 0 ms output logout
    2020-10-13 05:17:31 pm 1 ms failure Last exit code: 1
    Deployment has failed.

Here is my package file

{
  "name": "sts-skin-angular",
  "version": "0.0.0",
  "scripts": {
    "ng-high-memory-serve": "node --max_old_space_size=8000 ./node_modules/@angular/cli/bin/ng serve --port",
    "ng-high-memory-build": "node --max_old_space_size=8000 ./node_modules/@angular/cli/bin/ng build",
    "ng-high-memory-build-prod": "node --max_old_space_size=8000 ./node_modules/@angular/cli/bin/ng build --prod",
    "ng": "ng",
    "start": "npm run ng-high-memory-serve",
    "build": "npm run ng-high-memory-build --extract-css",
    "build:prod": "npm run ng-high-memory-build-prod",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e",
    "dev:ssr": "ng run sts-skin-angular:serve-ssr",
    "serve:ssr": "node dist/sts-skin-angular/server/main.js",
    "build:ssr": "ng build --prod && ng run sts-skin-angular:server:production",
    "prerender": "ng run sts-skin-angular:prerender"
  },
  "private": true,
  "dependencies": {
    "@agm/core": "^3.0.0-beta.0",
    "@angular-devkit/build-angular": "^0.1001.6",
    "@angular/animations": "~10.0.4",
    "@angular/cli": "^10.0.5",
    "@angular/common": "~10.0.4",
    "@angular/compiler": "~10.0.4",
    "@angular/compiler-cli": "~10.0.4",
    "@angular/core": "~10.0.4",
    "@angular/forms": "~10.0.4",
    "@angular/platform-browser": "~10.0.4",
    "@angular/platform-browser-dynamic": "~10.0.4",
    "@angular/platform-server": "~10.0.4",
    "@angular/router": "~10.0.4",
    "@nguniversal/builders": "^10.1.0",
    "@nguniversal/express-engine": "^10.0.1",
    "@ngx-translate/core": "^13.0.0",
    "@ngx-translate/http-loader": "^6.0.0",
    "@trademe/ng-defer-load": "^8.2.1",
    "@types/googlemaps": "^3.39.11",
    "buttercms": "^1.2.3",
    "express": "^4.15.2",
    "ng-image-slider": "^2.6.4",
    "ng6-toastr-notifications": "^1.0.4",
    "ngx-bootstrap": "^5.6.1",
    "ngx-cookie-service": "^10.0.1",
    "ngx-order-pipe": "^2.0.4",
    "ngx-pagination": "^5.0.0",
    "rxjs": "~6.6.3",
    "sweetalert": "^2.1.2",
    "tslib": "^2.0.0",
    "typescript": "~3.9.5",
    "zone.js": "~0.10.3"
  },
  "devDependencies": {
    "@types/express": "^4.17.0",
    "@types/jasmine": "~3.5.0",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "^12.11.1",
    "codelyzer": "^6.0.0",
    "jasmine-core": "~3.5.0",
    "jasmine-spec-reporter": "~5.0.0",
    "karma": "~5.0.0",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage-istanbul-reporter": "~3.0.2",
    "karma-jasmine": "~3.3.0",
    "karma-jasmine-html-reporter": "^1.5.0",
    "protractor": "~7.0.0",
    "ts-node": "~8.3.0",
    "tslint": "~6.1.0"
  }
}

UPDATE

<code>
Angular CLI: 10.0.5
Node: 13.7.0
OS: win32 x64

Angular: 10.0.7
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, platform-server
... router
Ivy Workspace: <error>

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.1001.6
@angular-devkit/build-angular     0.1001.6
@angular-devkit/build-optimizer   0.1001.6
@angular-devkit/build-webpack     0.1001.6
@angular-devkit/core              10.1.6
@angular-devkit/schematics        10.0.5
@angular/cli                      10.0.5
@ngtools/webpack                  10.1.6
@nguniversal/builders             10.1.0
@nguniversal/common               10.0.1
@nguniversal/express-engine       10.0.1
@schematics/angular               10.0.5
@schematics/update                0.1000.5
rxjs                              6.6.3
typescript                        3.9.7
webpack                           4.44.1
</code>

UPDATE AFTER SUGGESTED FIX NEW VERSION AND PACKAGE FILE

<code>
Angular CLI: 10.0.4
Node: 13.7.0
OS: win32 x64

Angular: 10.0.7
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, platform-server
... router
Ivy Workspace: <error>

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.1000.4
@angular-devkit/build-angular     0.1000.4
@angular-devkit/build-optimizer   0.1000.4
@angular-devkit/build-webpack     0.1000.4
@angular-devkit/core              10.0.4
@angular-devkit/schematics        10.0.4
@angular/cli                      10.0.4
@ngtools/webpack                  10.0.4
@nguniversal/builders             10.1.0
@nguniversal/common               10.1.0
@nguniversal/express-engine       10.1.0
@schematics/angular               10.0.4
@schematics/update                0.1000.4
rxjs                              6.6.3
typescript                        3.9.7
webpack                           4.43.0
</code>

<code>
{
  "name": "sts-skin-angular",
  "version": "0.0.0",
  "scripts": {
    "ng-high-memory-serve": "node --max_old_space_size=8000 ./node_modules/@angular/cli/bin/ng serve --port",
    "ng-high-memory-build": "node --max_old_space_size=8000 ./node_modules/@angular/cli/bin/ng build",
    "ng-high-memory-build-prod": "node --max_old_space_size=8000 ./node_modules/@angular/cli/bin/ng build --prod",
    "ng": "ng",
    "start": "npm run ng-high-memory-serve",
    "build": "npm run ng-high-memory-build --extract-css",
    "build:prod": "npm run ng-high-memory-build-prod",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e",
    "dev:ssr": "ng run sts-skin-angular:serve-ssr",
    "serve:ssr": "node dist/sts-skin-angular/server/main.js",
    "build:ssr": "ng build --prod && ng run sts-skin-angular:server:production",
    "prerender": "ng run sts-skin-angular:prerender"
  },
  "private": true,
  "dependencies": {
    "@agm/core": "^3.0.0-beta.0",
    "@angular-devkit/architect": "^0.1000.4",
    "@angular-devkit/build-angular": "~0.1000.4",
    "@angular-devkit/core": "^10.0.4",
    "@angular/animations": "~10.0.4",
    "@angular/cli": "~10.0.4",
    "@angular/common": "~10.0.4",
    "@angular/compiler": "~10.0.4",
    "@angular/compiler-cli": "~10.0.4",
    "@angular/core": "~10.0.4",
    "@angular/forms": "~10.0.4",
    "@angular/platform-browser": "~10.0.4",
    "@angular/platform-browser-dynamic": "~10.0.4",
    "@angular/platform-server": "~10.0.4",
    "@angular/router": "~10.0.4",
    "@nguniversal/builders": "^10.1.0",
    "@nguniversal/express-engine": "^10.0.4",
    "@ngx-translate/core": "^13.0.0",
    "@ngx-translate/http-loader": "^6.0.0",
    "@trademe/ng-defer-load": "^8.2.1",
    "@types/googlemaps": "^3.39.11",
    "buttercms": "^1.2.3",
    "express": "^4.15.2",
    "ng-image-slider": "^2.6.4",
    "ng6-toastr-notifications": "^1.0.4",
    "ngx-bootstrap": "^5.6.1",
    "ngx-cookie-service": "^10.0.1",
    "ngx-order-pipe": "^2.0.4",
    "ngx-pagination": "^5.0.0",
    "rxjs": "~6.6.3",
    "sweetalert": "^2.1.2",
    "tslib": "^2.0.0",
    "typescript": "~3.9.5",
    "zone.js": "~0.10.3"
  },
  "devDependencies": {
    "@types/express": "^4.17.0",
    "@types/jasmine": "~3.5.0",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "^12.11.1",
    "codelyzer": "^6.0.0",
    "jasmine-core": "~3.5.0",
    "jasmine-spec-reporter": "~5.0.0",
    "karma": "~5.0.0",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage-istanbul-reporter": "~3.0.2",
    "karma-jasmine": "~3.3.0",
    "karma-jasmine-html-reporter": "^1.5.0",
    "protractor": "~7.0.0",
    "ts-node": "~8.3.0",
    "tslint": "~6.1.0"
  }
}

</code>

Your @angular/cli and @angular-devkit/build-angular versions don't align. Make sure they align. It's generally safe if they reflect the version of the rest of your @angular packages ( 10.0.4 ). So update them to:

"@angular-devkit/build-angular": "~0.1000.4",
"@angular/cli": "~10.0.4",

Then delete your node_modules folder and rename your lock file.

npm: package-lock.json -> package-lock.json.old
yarn: yarn.lock -> yarn.lock.old

Run npm install or yarn install and build your app.

If everything is ok you can remove the old lock file package-lock.json.old or yarn.lock.old .

You should generally update Angular only with ng update as this might run important migrations.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM