@bvdmitri discovered (see below) that you can successfully build by using unabbreviated arguments:
ng build --target=production --environment=prod
Instead of:
ng build -prod
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
ng build -prodNote: ng build without -prod builds fine.
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)
I'd like it to build my project without an error. :)
As mentioned above:
https://github.com/angular/angular/issues/20360https://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": {}
}
}
Same issue for me, it happens on npm start. The weird thing is that the issue appeared on one machine but not another. Here's the error:
Schema validation failed with the following errors:
Data path "" should NOT have additional properties (i18nLocale).
Error: Schema validation failed with the following errors:
Data path "" should NOT have additional properties (i18nLocale).
at MergeMapSubscriber.registry.compile.pipe.operators_1.concatMap.validatorResult [as project] (D:\Projects\Jaddeer\Jadir Client\node_modules\@angular-devkit\architect\src\architect.js:218:39)
at MergeMapSubscriber._tryNext (D:\Projects\Jaddeer\Jadir Client\node_modules\rxjs\operators\mergeMap.js:122:27)
at MergeMapSubscriber._next (D:\Projects\Jaddeer\Jadir Client\node_modules\rxjs\operators\mergeMap.js:112:18)
at MergeMapSubscriber.Subscriber.next (D:\Projects\Jaddeer\Jadir Client\node_modules\rxjs\Subscriber.js:90:18)
at MergeMapSubscriber.notifyNext (D:\Projects\Jaddeer\Jadir Client\node_modules\rxjs\operators\mergeMap.js:145:30)
at InnerSubscriber._next (D:\Projects\Jaddeer\Jadir Client\node_modules\rxjs\InnerSubscriber.js:23:21)
at InnerSubscriber.Subscriber.next (D:\Projects\Jaddeer\Jadir Client\node_modules\rxjs\Subscriber.js:90:18)
at MapSubscriber._next (D:\Projects\Jaddeer\Jadir Client\node_modules\rxjs\operators\map.js:85:26)
at MapSubscriber.Subscriber.next (D:\Projects\Jaddeer\Jadir Client\node_modules\rxjs\Subscriber.js:90:18)
at SwitchMapSubscriber.notifyNext (D:\Projects\Jaddeer\Jadir Client\node_modules\rxjs\operators\switchMap.js:126:30)
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!
I get the same error using ng serve --aot=true (worked with 6.0.0-beta.5)
$ ng serve --aot
Schema validation failed with the following errors:
Data path "" should NOT have additional properties (aot).
Error: Schema validation failed with the following errors:
Data path "" should NOT have additional properties (aot).
at MergeMapSubscriber.registry.compile.pipe.operators_1.concatMap.validatorResult [as project] (/Users/benneq/Development/ng6/node_modules/@angular-devkit/architect/src/architect.js:218:39)
at MergeMapSubscriber._tryNext (/Users/benneq/Development/ng6/node_modules/rxjs/operators/mergeMap.js:122:27)
at MergeMapSubscriber._next (/Users/benneq/Development/ng6/node_modules/rxjs/operators/mergeMap.js:112:18)
at MergeMapSubscriber.Subscriber.next (/Users/benneq/Development/ng6/node_modules/rxjs/Subscriber.js:90:18)
at MergeMapSubscriber.notifyNext (/Users/benneq/Development/ng6/node_modules/rxjs/operators/mergeMap.js:145:30)
at InnerSubscriber._next (/Users/benneq/Development/ng6/node_modules/rxjs/InnerSubscriber.js:23:21)
at InnerSubscriber.Subscriber.next (/Users/benneq/Development/ng6/node_modules/rxjs/Subscriber.js:90:18)
at MapSubscriber._next (/Users/benneq/Development/ng6/node_modules/rxjs/operators/map.js:85:26)
at MapSubscriber.Subscriber.next (/Users/benneq/Development/ng6/node_modules/rxjs/Subscriber.js:90:18)
at SwitchMapSubscriber.notifyNext (/Users/benneq/Development/ng6/node_modules/rxjs/operators/switchMap.js:126:30)
Got the same issue with
ng build --aot -prod --extract-licenses --vendor-chunk --output-hashing=none --build-optimizer
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] (node_modules/@angular-devkit/architect/src/architect.js:218:39)
at MergeMapSubscriber._tryNext (node_modules/rxjs/operators/mergeMap.js:122:27)
at MergeMapSubscriber._next (node_modules/rxjs/operators/mergeMap.js:112:18)
at MergeMapSubscriber.Subscriber.next (node_modules/rxjs/Subscriber.js:90:18)
at MergeMapSubscriber.notifyNext (node_modules/rxjs/operators/mergeMap.js:145:30)
at InnerSubscriber._next (node_modules/rxjs/InnerSubscriber.js:23:21)
at InnerSubscriber.Subscriber.next (node_modules/rxjs/Subscriber.js:90:18)
at MapSubscriber._next (node_modules/rxjs/operators/map.js:85:26)
at MapSubscriber.Subscriber.next (node_modules/rxjs/Subscriber.js:90:18)
at SwitchMapSubscriber.notifyNext (node_modules/rxjs/operators/switchMap.js:126:30)
^^^
There is no error with
--target=production --environment=prod
instead of
@bvdmitri - you are correct. I was able to successfully build using --target=production --environment=prod.
I get the same error running ng serve --proxy-config proxy.conf.json --no-delete-output-path --base-href '/'
@bvdmitri @etsuo --target=production --environment=prod worked but my dev environment was picked up in the final bundle not the prod one !!!
Also when i try --target=production --environment=anyotherenv he is always picking the dev one.
Did you have the same issue ?
Using --prod (instead of -prod) solved the problem for me
Do you get any errors using ng serve with parameters? e.g. ng serve --aot=true --proxy-config proxy.conf.json?
I do: no error when only using
"start": "ng serve",
in my package.json.
The error appears when I start the same project with parameter
"start": "ng serve -p 4201",
(no matter which port No.). Didn't try other params.
In all former setups/versions I never had this problem.
Looks like at least the existence of parameters in ng-serve causes the problem.
_But, when I use --port 4201 instead of -p 4201, the error disappears again. Presumably some syntax change by the developers or abbreviations are not parsed correctly anymore._
Here's my environment:
Windows 7, in PhpStorm 2017.3 shell and MINGW64
package.json which produces the error:
"name": "...",
"version": "0.0.2",
"license": "MIT",
"scripts": {
"ng": "ng",
"lint": "ng lint",
"pree2e": "webdriver-manager update --standalone false --gecko false --quiet",
"build": "ng build",
"start": "ng serve -p 4201",
"test": "ng test",
"e2e": "ng e2e",
"doc": "ng doc"
},
"private": true,
"dependencies": {
"@angular/animations": "^6.0.0-rc.0",
"@angular/cdk": "github:angular/cdk-builds",
"@angular/common": "^6.0.0-rc.0",
"@angular/compiler": "^6.0.0-rc.0",
"@angular/core": "^6.0.0-rc.0",
"@angular/forms": "^6.0.0-rc.0",
"@angular/http": "^6.0.0-rc.0",
"@angular/material": "github:angular/material2-builds",
"@angular/platform-browser": "^6.0.0-rc.0",
"@angular/platform-browser-dynamic": "^6.0.0-rc.0",
"@angular/router": "^6.0.0-rc.0",
"core-js": "^2.5.3",
"rxjs": "^5.6.0-forward-compat.0 || ^6.0.0-alpha.4",
"zone.js": "^0.8.20"
},
"devDependencies": {
"rxjs-compat": "^6.0.0-beta.1",
"@angular/cli": "^6.0.0-beta.6",
"@angular/compiler-cli": "^6.0.0-rc.0",
"@angular/language-service": "^6.0.0-rc.0",
"@types/jasmine": "^2.8.6",
"@types/jasminewd2": "^2.0.3",
"@types/node": "^9.4.7",
"autoprefixer": "^8.1.0",
"circular-dependency-plugin": "^4.4.0",
"codelyzer": "^4.2.1",
"css-loader": "^0.28.11",
"cssnano": "^3.10.0",
"exports-loader": "^0.7.0",
"file-loader": "^1.1.11",
"html-webpack-plugin": "^3.0.7",
"istanbul-instrumenter-loader": "^3.0.0",
"jasmine-core": "~3.1.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "^2.0.0",
"karma-chrome-launcher": "~2.2.0",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^1.4.2",
"karma-jasmine": "^1.1.1",
"karma-jasmine-html-reporter": "^0.2.2",
"less-loader": "^4.1.0",
"postcss-loader": "^2.1.3",
"postcss-url": "^7.3.1",
"protractor": "~5.3.0",
"raw-loader": "^0.5.1",
"sass-loader": "^6.0.7",
"script-loader": "^0.7.2",
"source-map-loader": "^0.2.3",
"style-loader": "^0.20.3",
"stylus-loader": "^3.0.2",
"ts-node": "~5.0.1",
"tslint": "~5.9.1",
"typescript": "^2.7.2",
"url-loader": "^1.0.1",
"webpack": "~4.2.0",
"webpack-dev-server": "^3.1.1"
},
"main": "index.js",
"repository": "...",
"author": "..."
}
@omahjoub yes, I just checked and ng build picks only dev environment. I couldn’t force the cli to pick the proper environment file. Also I realized that in my project “ng build” command is not respecting any parameters in .angular-cli.json file (outDir, deployUrl etc..) and it just picking the default ones. I should manually set this parameters in npm task (ng build —deploy-url=blabla etc). Is it correct behavior for the new version of angular-cli?
I now set up a new project and upgraded to the latest dependencies (angular 6.0.0-rc.0, angular cli 6.0.0-beta.6, rxjs 6.0.0-beta.1, rxjs-compat 6.0.0-beta.1).
I encountered following issues with ng serve:
--aot (this is crucial for development with es2015 output)--progress--proxy-config only works with ../proxy.conf.json, before it worked with proxy.conf.json (this bug was also mentioned in this issue before with ng build)Before that I was using Angular CLI 6.0.0-beta.5 where everything worked fine.
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 throws
Project 'production' could not be found in workspace.
Error: Project 'production' could not be found in workspace.
When I run ng build --env=prerelease --prod instead it throws
Schema validation failed with the following errors:
Data path "" should NOT have additional properties (env).
Even if I only run ng build --prod I get an error, which is
Cannot read property 'match' of undefined
TypeError: Cannot read property 'match' of undefined
at Object.normalize (<path-to-app>\node_modules\@angular-devkit\build-angular\node_modules\@angular-devkit\core\src\virtual-fs\path.js:178:14)
at options.fileReplacements.forEach (<path-to-app>\node_modules\@angular-devkit\build-angular\src\browser\index.js:99:55)
at Array.forEach (<anonymous>)
at BrowserBuilder.buildWebpackConfig [...]
My upgrade strategy for the last versions was like this:
npm i g @angular/cli@next
ng new foo --next
(merge your old package.json into the new one)
(copy your project files into the new folder)
npm i
This takes about 10-20 minutes, but then you can be sure, that you didn't mess the config up.
Every time I tried to manually "upgrade" the project using ng update and modifying the package.json, something went wrong. Additionally they changed a lot in terms of options and folder layout in the last versions.
+1
I was able to fix this on my project by removing the majority of the -- flags from ng build (--aot --sourcemaps --extract-css etc) and instead use --configuration someName and put all the flags inside the angular.json file under the corresponding configuration.
The fact that it's checking schema now is actually pretty cool, because I was previously passing the same flags for ng serve, ng build, & for server build for universal rendering, however some flags aren't actually valid for all 3 types of builds.
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.
Hello guyz, i solved it by changing the styleExt attribute to Schematics rule:
instead of
...
...
...
},
"defaults": {
"styleExt": "less",**
"component": {}
}
change to
"projects": {
"delegations": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"prefix": "del",
"schematics": {
"@schematics/angular:component": {
"styleext": "less"
}
},
Still facing same error ?
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._
Most helpful comment
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-prodwill 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.