angular-cli: 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/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": {}
}
}
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 13
- Comments: 29 (2 by maintainers)
Hello guyz, i solved it by changing the
styleExt
attribute to Schematics rule: instead ofchange to
Hi all,
In Angular CLI v6 it is by design that arguments only work with the double dash. The correct argument is only
--prod
, and-prod
will not work.Sorry for the confusion. We will add this to the CLI v6 release announcement so that no one else is surprised by it.
I just recently updated to 6.0.0-rc.0 after a dependency was unresolvable in 6.0.0-beta.4 (html-webpack-plugin if anyone is interested). I deleted ‘node_modules’ and ‘dist’ as stated in the manual for updating local project package.
But now I cannot build for custom environments anymore.
Whenever I try to run
ng build --env=prerelease --target=production
it throwsWhen I run
ng build --env=prerelease --prod
instead it throwsEven if I only run
ng build --prod
I get an error, which isI get the same error running
ng serve --proxy-config proxy.conf.json --no-delete-output-path --base-href '/'
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:
any ideas?
Do you get any errors using
ng serve
with parameters? e.g.ng serve --aot=true --proxy-config proxy.conf.json
?^^^ There is no error with
instead of
It seems that the issue is related to the command: ng serve --locale ar-SA --proxy-config proxy.config.json
after changing it to: ng serve --proxy-config …/proxy.config.json
Things worked fine. Notice also the proxy config are not being found on the root folder but in the src!