ng build -prod throws Data path "" should NOT have additional properties (p)
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
ng build -prod- 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:
- I have a service worker configued
- I have an app shell configued
- I'm using beta to try to get around:
https://github.com/angular/angular/issues/20360https://github.com/maciejtreder/angular-universal-pwa/blob/master/src/app/server-app.module.tshttps://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": {}
}
}
Hi All, I am facing a very similar issue. One peculiar thing on my side is the file against $schema in my angular.json file. This link is referencing to a file which exists, however it says that it is unable to load schema from this file - gives wiggly line under the file name:

Schema validation failed with the following errors:
Data path "" should NOT have additional properties(environments).
Error: Schema validation failed with the following errors:
Data path "" should NOT have additional properties(environments).
at MergeMapSubscriber._registry.compile.pipe.operators_1.concatMap.validatorResult [as project] (G:\Web\vpmoAngular\node_modules\@angular\cli\node_modules\@angular-devkit\core\src\workspace\workspace.js:198:42)
at MergeMapSubscriber._tryNext (G:\Web\vpmoAngular\node_modules\rxjs\internal\operators\mergeMap.js:122:27)
at MergeMapSubscriber._next (G:\Web\vpmoAngular\node_modules\rxjs\internal\operators\mergeMap.js:112:18)
at MergeMapSubscriber.Subscriber.next (G:\Web\vpmoAngular\node_modules\rxjs\internal\Subscriber.js:103:18)
at MergeMapSubscriber.notifyNext (G:\Web\vpmoAngular\node_modules\rxjs\internal\operators\mergeMap.js:141:26)
at InnerSubscriber._next (G:\Web\vpmoAngular\node_modules\rxjs\internal\InnerSubscriber.js:30:21)
at InnerSubscriber.Subscriber.next (G:\Web\vpmoAngular\node_modules\rxjs\internal\Subscriber.js:103:18)
at MapSubscriber._next (G:\Web\vpmoAngular\node_modules\rxjs\internal\operators\map.js:92:26)
at MapSubscriber.Subscriber.next (G:\Web\vpmoAngular\node_modules\rxjs\internal\Subscriber.js:103:18)
at SwitchMapSubscriber.notifyNext (G:\Web\vpmoAngular\node_modules\rxjs\internal\operators\switchMap.js:122:26)
my package.json is as follow:
{
"name": "xxx",
"version": "6.0.1",
"license": "xxx",
"scripts": {
"ng": "ng",
"start": "ng serve --open",
"start-hmr": "ng serve --configuration hmr -sm=false",
"start-hmr-sourcemaps": "ng serve --hmr -e=hmr",
"build": "node --max_old_space_size=6144 ./node_modules/@angular/cli/bin/ng build --dev",
"build-stats": "node --max_old_space_size=6144 ./node_modules/@angular/cli/bin/ng build --dev --stats-json",
"build-prod": "node --max_old_space_size=6144 ./node_modules/@angular/cli/bin/ng build --prod",
"build-prod-stats": "node --max_old_space_size=6144 ./node_modules/@angular/cli/bin/ng build --prod --stats-json",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"bundle-report": "webpack-bundle-analyzer dist/stats.json"
},
"private": true,
"dependencies": {
"@angular/animations": "6.0.0",
"@angular/cdk": "6.0.1",
"@angular/common": "6.0.0",
"@angular/compiler": "6.0.0",
...
}
"devDependencies": {
"@angular-devkit/build-angular": "^0.7.5",
"@angular/cli": "6.1.4",
"@angular/compiler-cli": "6.0.0",
"@angular/language-service": "6.0.0",
"@angularclass/hmr": "2.1.3",
"@types/jasmine": "2.8.7",
"@types/jasminewd2": "2.0.3",
"@types/lodash": "4.14.108",
"@types/node": "8.9.5",
"codelyzer": "4.2.1",
...
}
}
In my case, a friend told me to remove environments tags from angular.json and it fixed the problem. The issue is resolved for me.
Create a fresh ng project using latest angular-cli and compare angular.json with your project's angular.json. You might be able to figure our the issue.
Check that the @angular/cli version you used to create the project is the same as the one you have listed in the package.json. If they are different then the @angular/cli you crated the project with includes extra or deprecated entries in the angular.json file.
To correct it verify which fields are not compatible and remove them, or, re-create the project with compatible @angular/cli versions.
I've experienced this issue after change the default:
@angular-devkit/build-angular:browser in angular.json
and start using:
@angular-builders/custom-webpack
in order to extend environment configurations in the app, the exact error is:
Schema validation failed with the following errors:
Data path "" should NOT have additional properties(path).
npm ERR! code ELIFECYCLE
any ideas?
Yes, I know the reason
I've experienced this issue after change the default:
@angular-devkit/build-angular:browser in angular.json
and start using:
@angular-builders/custom-webpack
in order to extend environment configurations in the app, the exact error is:
Schema validation failed with the following errors: Data path "" should NOT have additional properties(path). npm ERR! code ELIFECYCLEany ideas?
"builder": "@angular-builders/custom-webpack:browser",
"options": {
"customWebpackConfig": { "path": "./extra-webpack.config.js",
"mergeStrategies": { "externals": "replace" }},
"outputPath": "dist/angular-custom-elements",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.app.json",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.css"
],
"scripts": [
{
"input": "node_modules/document-register-element/build/document-register-element.js"
}
],
"es5BrowserSupport": true
},
I had incorrectly placed the curly brace before mergeStrategies.
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.