Skip to content

ng build -prod throws Data path "" should NOT have additional properties (p) #9994

Closed
@etsuo

Description

@etsuo

Workaround

@bvdmitri discovered (see below) that you can successfully build by using unabbreviated arguments:

ng build --target=production --environment=prod

Instead of:

ng build -prod

Versions

Angular CLI: 6.0.0-beta.6
Node: 8.9.0
OS: darwin x64
Angular: 6.0.0-beta.8
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, platform-server, router
... service-worker

@angular/cdk: 6.0.0-beta.4
@angular/cli: 6.0.0-beta.6
@angular/material: 6.0.0-beta.4
@angular-devkit/architect: 0.0.7
@angular-devkit/build-optimizer: 0.4.6
@angular-devkit/build-webpack: 0.0.7
@angular-devkit/core: 0.4.6
@angular-devkit/schematics: 0.4.6
@ngtools/json-schema: 1.2.0
@ngtools/webpack: 6.0.0-beta.6
@schematics/angular: 0.4.6
@schematics/package-update: 0.4.6
typescript: 2.7.2
webpack: 4.1.1

Repro steps

  1. ng build -prod
  2. error

Note: ng build without -prod builds fine.

Observed behavior

Schema validation failed with the following errors:
  Data path "" should NOT have additional properties (p).
Error: Schema validation failed with the following errors:
  Data path "" should NOT have additional properties (p).
    at MergeMapSubscriber.registry.compile.pipe.operators_1.concatMap.validatorResult [as project] (/Users/dev/sakuraapi/sakuraapi.com/node_modules/@angular-devkit/architect/src/architect.js:218:39)
    at MergeMapSubscriber._tryNext (/Users/dev/sakuraapi/sakuraapi.com/node_modules/rxjs/operators/mergeMap.js:122:27)
    at MergeMapSubscriber._next (/Users/dev/sakuraapi/sakuraapi.com/node_modules/rxjs/operators/mergeMap.js:112:18)
    at MergeMapSubscriber.Subscriber.next (/Users/dev/sakuraapi/sakuraapi.com/node_modules/rxjs/Subscriber.js:90:18)
    at MergeMapSubscriber.notifyNext (/Users/dev/sakuraapi/sakuraapi.com/node_modules/rxjs/operators/mergeMap.js:145:30)
    at InnerSubscriber._next (/Users/dev/sakuraapi/sakuraapi.com/node_modules/rxjs/InnerSubscriber.js:23:21)
    at InnerSubscriber.Subscriber.next (/Users/dev/sakuraapi/sakuraapi.com/node_modules/rxjs/Subscriber.js:90:18)
    at MapSubscriber._next (/Users/dev/sakuraapi/sakuraapi.com/node_modules/rxjs/operators/map.js:85:26)
    at MapSubscriber.Subscriber.next (/Users/dev/sakuraapi/sakuraapi.com/node_modules/rxjs/Subscriber.js:90:18)
    at SwitchMapSubscriber.notifyNext (/Users/dev/sakuraapi/sakuraapi.com/node_modules/rxjs/operators/switchMap.js:126:30)

Desired behavior

I'd like it to build my project without an error. :)

Mention any other details that might be useful (optional)

As mentioned above:

  1. I have a service worker configued
  2. I have an app shell configued
  3. I'm using beta to try to get around:
  • https://github.com/angular/angular/issues/20360
  • https://github.com/maciejtreder/angular-universal-pwa/blob/master/src/app/server-app.module.ts
  • https://github.com/angular/angular/pull/20782

.angular-cli.json:

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "project": {
    "name": "website"
  },
  "apps": [
    {
      "root": "src",
      "outDir": "dist",
      "assets": [
        "assets",
        "favicon.ico"
      ],
      "index": "index.html",
      "main": "main.ts",
      "polyfills": "polyfills.ts",
      "test": "test.ts",
      "tsconfig": "tsconfig.app.json",
      "testTsconfig": "tsconfig.spec.json",
      "prefix": "app",
      "styles": [
        "../node_modules/normalize.css/normalize.css",
        "sass/styles.scss"
      ],
      "scripts": [],
      "environmentSource": "environments/environment.ts",
      "environments": {
        "dev": "environments/environment.ts",
        "prod": "environments/environment.prod.ts"
      },
      "serviceWorker": true,
      "appShell": {
        "app": "sapi-app-shell",
        "route": "app-shell-path"
      }
    },
    {
      "root": "src",
      "outDir": "dist-server",
      "assets": [
        "assets",
        "favicon.ico"
      ],
      "index": "index.html",
      "main": "main.server.ts",
      "test": "test.ts",
      "tsconfig": "tsconfig.server.json",
      "testTsconfig": "tsconfig.spec.json",
      "prefix": "app",
      "styles": [
        "../node_modules/normalize.css/normalize.css",
        "sass/styles.scss"
      ],
      "scripts": [],
      "environmentSource": "environments/environment.ts",
      "environments": {
        "dev": "environments/environment.ts",
        "prod": "environments/environment.prod.ts"
      },
      "serviceWorker": true,
      "platform": "server",
      "name": "sapi-app-shell"
    }
  ],
  "e2e": {
    "protractor": {
      "config": "./protractor.conf.js"
    }
  },
  "lint": [
    {
      "project": "src/tsconfig.app.json",
      "exclude": "**/node_modules/**"
    },
    {
      "project": "src/tsconfig.spec.json",
      "exclude": "**/node_modules/**"
    },
    {
      "project": "e2e/tsconfig.e2e.json",
      "exclude": "**/node_modules/**"
    }
  ],
  "test": {
    "karma": {
      "config": "./karma.conf.js"
    }
  },
  "defaults": {
    "styleExt": "scss",
    "component": {}
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions