Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Schema validation failed: Data path "" should NOT have additional properties #11479

Open
LastDragon-ru opened this issue Jul 6, 2018 · 22 comments

Comments

@LastDragon-ru
Copy link

LastDragon-ru commented Jul 6, 2018

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request

Area

- [ ] devkit
- [x] schematics

Versions

Angular CLI: 6.0.8
Node: 8.11.2
OS: win32 x64
Angular: 6.0.7
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.6.8
@angular-devkit/build-angular     0.6.8
@angular-devkit/build-optimizer   0.6.8
@angular-devkit/core              0.6.8
@angular-devkit/schematics        0.6.8
@angular/cli                      6.0.8
@ngtools/webpack                  6.0.8
@schematics/angular               0.6.8
@schematics/update                0.6.8
rxjs                              6.2.1
typescript                        2.7.2
webpack                           4.8.3

Repro steps

  1. Add projects/architect/<section>/options/invalid options to options in angular.json eg
    "build": {
           "builder": "@angular-devkit/build-angular:browser",
           "options": {
             "invalid": "value", 
             ...
           }
    }
    
  2. Run ng build

Actual functionality

Schema validation failed with the following errors:
  Data path "" should NOT have additional properties(invalid).

Desired functionality

Schema validation failed with the following errors:
  Data path "path/to/invalid/option" should NOT have additional properties(invalid).
@ChamNouki
Copy link

ChamNouki commented Jul 10, 2018

I have some kind of a similar issue but when I run ng serve :

Schema validation failed with the following errors:
  Data path "" should NOT have additional properties(watch).

Furthermore there is no watch property in my angular.json

packages version of my project :

Angular CLI: 6.0.8
Node: 10.1.0
OS: darwin x64
Angular: 6.0.7
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.6.8
@angular-devkit/build-angular      0.6.8
@angular-devkit/build-ng-packagr   0.6.8
@angular-devkit/build-optimizer    0.6.8
@angular-devkit/core               0.6.8
@angular-devkit/schematics         0.6.8
@angular/cdk                       6.3.2
@angular/cli                       6.0.8
@angular/material                  6.3.2
@ngtools/json-schema               1.1.0
@ngtools/webpack                   6.0.8
@schematics/angular                0.6.8
@schematics/update                 0.6.8
ng-packagr                         3.0.3
rxjs                               6.2.1
typescript                         2.7.2
webpack                            4.8.3

@ernie58
Copy link

ernie58 commented Aug 31, 2018

I'm experiencing the same problem.
I'm trying to run cypress as e2e test-runner.
This is the config as described in de examples:

"test-cypress-app-e2e": {
      "root": "e2e/",
      "projectType": "application",
      "architect": {
        "e2e": {
          "builder": "ngx-cypress-builder:cypress",
          "options": {
            "devServerTarget": "test-cypress-app:serve",
            "mode": "browser"
          },
          "configurations": {
            "production": {
              "devServerTarget": "test-cypress-app:serve:production"
            }
          }
        },
        "lint": {
          "builder": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": "e2e/tsconfig.e2e.json",
            "exclude": [
              "**/node_modules/**"
            ]
          }
        }
      }
    }
  },

I get an error :

Schema validation failed with the following errors:
  Data path "" should NOT have additional properties(mode).

Mode is however a valid property, as seen in this example:
https://github.com/isaacplmann/ngx-cypress-builder/blob/master/sample/angular.json

Angular CLI: 6.1.5
Node: 8.11.2
OS: darwin x64
Angular: 6.1.6
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.7.5
@angular-devkit/build-angular     0.7.5
@angular-devkit/build-optimizer   0.7.5
@angular-devkit/build-webpack     0.7.5
@angular-devkit/core              0.7.5
@angular-devkit/schematics        0.7.5
@angular/cli                      6.1.5
@ngtools/webpack                  6.1.5
@schematics/angular               0.7.5
@schematics/update                0.7.5
rxjs                              6.2.2
typescript                        2.7.2
webpack                           4.9.2

@b0ric
Copy link

b0ric commented Sep 1, 2018

Confirming the issue, getting the following error

Schema validation failed with the following errors:
  Data path "" should NOT have additional properties(port).

Though in my case I really specified nonexistent property, it would be nice for angular-cli to refer to it correctly.

PS: package versions

Angular CLI: 6.0.8
Node: 10.9.0
OS: darwin x64
Angular: 6.1.6
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.6.8
@angular-devkit/build-angular     0.6.8
@angular-devkit/build-optimizer   0.6.8
@angular-devkit/core              0.6.8
@angular-devkit/schematics        0.6.8
@angular/cli                      6.0.8
@ngtools/webpack                  6.0.8
@schematics/angular               0.6.8
@schematics/update                0.6.8
rxjs                              6.3.0
typescript                        2.7.2
webpack                           4.8.3

@jordandlaman
Copy link

So it looks like the npm package is out of date compared to master. The npm package is on 0.0.2 and the github repo version is 1.0.0. I installed it using the yarn add -D isaacplmann/ngx-cypress-builder#master but am now getting Could not find module "ngx-cypress-builder" because I don't think the files are compiled. @isaacplmann might help if we get the npm package udpated.

@isaacplmann
Copy link

@jordandlaman why are you commenting on this issue? If you run into a problem with ngx-cypress-builder, file an issue here:
https://github.com/isaacplmann/ngx-cypress-builder

@isaacplmann
Copy link

@ernie58 I would have responded a lot faster, if you filed an issue directly on my repo

@jordandlaman
Copy link

jordandlaman commented Sep 21, 2018

Was just trying to point people in the right direction. This may sound stupid but when I was on your repo earlier I didn't see the option to submit an issue. Issue filed.

@isaacplmann
Copy link

Sorry, thanks. I'll take a look.

@mcsekar12
Copy link

Check if your apps angular.json file is valid and any changes you made to that file are correct

@eldoseambat
Copy link

another issue showing

Schema validation failed with the following errors:
Data path "" should have required property 'tsConfig'.

@ngbot ngbot bot added this to the Backlog milestone Jan 24, 2019
@stefantrost
Copy link

For anyone having this problem while updating Ionic from 3 to 4: I had to remove "es5BrowserSupport": true from angular.json

@krishnageethika
Copy link

Schema validation failed with the following errors:
[ng] Data path "" should NOT have additional properties(es5BrowserSupport).

[ERROR] ng has unexpectedly closed (exit code 1).

@krishnageethika
Copy link

For anyone having this problem while updating Ionic from 3 to 4: I had to remove "es5BrowserSupport": true from angular.json

But if I'm removing that I'm getting the below error

[ng] 
[ng] Error: tsconfig.json(18,7): error TS6046: Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'esnext', 'dom', 'dom.iterable', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'esnext.asynciterable'.
[ng]     at AngularCompilerPlugin._setupOptions (D:\ionic-pdf-master4\node_modules\@ngtools\webpack\src\angular_compiler_plugin.js:108:19)
[ng]     at new AngularCompilerPlugin (D:\ionic-pdf-master4\node_modules\@ngtools\webpack\src\angular_compiler_plugin.js:61:14)
[ng]     at _createAotPlugin (D:\ionic-pdf-master4\node_modules\@angular-devkit\build-angular\src\angular-cli-files\models\webpack-configs\typescript.js:41:12)
[ng]     at Object.getNonAotConfig (D:\ionic-pdf-master4\node_modules\@angular-devkit\build-angular\src\angular-cli-files\models\webpack-configs\typescript.js:47:19)
[ng]     at BrowserBuilder.buildWebpackConfig (D:\ionic-pdf-master4\node_modules\@angular-devkit\build-angular\src\browser\index.js:82:37)
[ng]     at DevServerBuilder.buildWebpackConfig (D:\ionic-pdf-master4\node_modules\@angular-devkit\build-angular\src\dev-server\index.js:111:46)
[ng]     at MergeMapSubscriber.check_port_1.checkPort.pipe.operators_1.concatMap [as project] (D:\ionic-pdf-master4\node_modules\@angular-devkit\build-angular\src\dev-server\index.js:38:40)
[ng]     at MergeMapSubscriber._tryNext (D:\ionic-pdf-master4\node_modules\@angular-devkit\build-angular\node_modules\rxjs\internal\operators\mergeMap.js:69:27)
[ng]     at MergeMapSubscriber._next (D:\ionic-pdf-master4\node_modules\@angular-devkit\build-angular\node_modules\rxjs\internal\operators\mergeMap.js:59:18)
[ng]     at MergeMapSubscriber.Subscriber.next (D:\ionic-pdf-master4\node_modules\@angular-devkit\build-angular\node_modules\rxjs\internal\Subscriber.js:66:18)
[ng]     at TapSubscriber._next (D:\ionic-pdf-master4\node_modules\@angular-devkit\build-angular\node_modules\rxjs\internal\operators\tap.js:65:26)
[ng]     at TapSubscriber.Subscriber.next (D:\ionic-pdf-master4\node_modules\@angular-devkit\build-angular\node_modules\rxjs\internal\Subscriber.js:66:18)
[ng]     at MergeMapSubscriber.notifyNext (D:\ionic-pdf-master4\node_modules\@angular-devkit\build-angular\node_modules\rxjs\internal\operators\mergeMap.js:92:26)
[ng]     at InnerSubscriber._next (D:\ionic-pdf-master4\node_modules\@angular-devkit\build-angular\node_modules\rxjs\internal\InnerSubscriber.js:28:21)
[ng]     at InnerSubscriber.Subscriber.next (D:\ionic-pdf-master4\node_modules\@angular-devkit\build-angular\node_modules\rxjs\internal\Subscriber.js:66:18)
[ng]     at Object.complete (D:\ionic-pdf-master4\node_modules\@angular-devkit\build-angular\node_modules\rxjs\internal\observable\forkJoin.js:57:40)

[ERROR] ng has unexpectedly closed (exit code 1).

@CJ42
Copy link

CJ42 commented Jul 4, 2019

I posted a fix to a similar schema validation error in #14338

Based on these two answers on StackOverflow also related to schema validation errors :

  1. Updated package.json from "@angular-devkit/build-angular": "^0.800.1" to "^0.12.4"
  2. Run npm install

See if that works.

@clydin
Copy link
Member

clydin commented Jul 4, 2019

Please note that 0.12.4 is significantly older than 0.800.1.

@kyliau kyliau added triage #1 area: devkit/schematics needs: investigation Requires some digging to determine if action is needed and removed area: angular/cli labels May 27, 2020
@jnfaerch
Copy link

Apart from the error message not telling WHERE the problem is, it does tell you WHAT the problem is. I fixed one error and it gave me the next, which I fixed and so on.

Angular 11 with latest packages including "@angular-devkit/build-angular": "^0.1100.2"

For me it was my angular.json e2e lint where I had to change

from this

                "lint": {
                    "builder": "@angular-eslint/builder:lint",
                    "options": {
                        "tsConfig": "e2e/tsconfig.e2e.json",
                        "exclude": ["**/node_modules/**"]
                    }
                }

to this

                "lint": {
                    "builder": "@angular-eslint/builder:lint",
                    "options": {
                        "lintFilePatterns": ["e2e/**/*.ts", "e2e/**/*.html"]
                    }
                }

@MickL
Copy link

MickL commented Mar 8, 2021

I cant set allowedCommonJsDependencies as described here: https://angular.io/guide/build#configuring-commonjs-dependencies :

Schema validation failed with the following errors:
Data path "" should NOT have additional properties(allowedCommonJsDependencies).

Version:

Angular CLI: 11.2.3
Node: 15.6.0
OS: darwin x64

Angular: 11.2.4
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Ivy Workspace: Yes

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1102.3
@angular-devkit/build-angular   0.1102.3
@angular-devkit/core            11.2.3
@angular-devkit/schematics      11.2.3
@angular/cli                    11.2.3
@schematics/angular             11.2.3
@schematics/update              0.1102.3
ng-packagr                      11.2.4
rxjs                            6.6.3
typescript                      4.0.7

@tamusjroyce
Copy link

In angular.json I had:

        "lint": {
          "builder": "@angular-eslint/builder:lint",
          "options": {
            "lintFilePatterns": [
              "src/**/*.ts",
              "src/**/*.html"
            ],
            "tsConfig": [
              "projects/px-visualizations/tsconfig.lib.json",
              "projects/px-visualizations/tsconfig.spec.json"
            ],
            "exclude": [
              "**/node_modules/**"
            ]
          }

and got

Schema validation failed with the following errors:
Data path "" should NOT have additional properties(tsConfig).

After upgrading from tslint to eslint. Luckely I was able to find this change in source control. It would be really helpful for the error to explain which invalid items are the issue.

        "lint": {
          "builder": "@angular-eslint/builder:lint",
          "options": {
            "lintFilePatterns": [
              "src/**/*.ts",
              "src/**/*.html"
            ]
          }

Fixed it. But I had no way other than guessing and reviewing source control to determine what the issue was.

@AlexFreem
Copy link

AlexFreem commented Jun 17, 2021

I cant set allowedCommonJsDependencies as described here: https://angular.io/guide/build#configuring-commonjs-dependencies :

Schema validation failed with the following errors:
Data path "" should NOT have additional properties(allowedCommonJsDependencies).

Version:

Angular CLI: 11.2.3
Node: 15.6.0
OS: darwin x64

Angular: 11.2.4
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Ivy Workspace: Yes

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1102.3
@angular-devkit/build-angular   0.1102.3
@angular-devkit/core            11.2.3
@angular-devkit/schematics      11.2.3
@angular/cli                    11.2.3
@schematics/angular             11.2.3
@schematics/update              0.1102.3
ng-packagr                      11.2.4
rxjs                            6.6.3
typescript                      4.0.7

Has same error when using as builder angular-builders/custom-webpack:dev-server or angular-builders/custom-webpack:browser

@relativist
Copy link

relativist commented Jul 6, 2021

Same error. Fixed by change schematics in angular.json

was
"schematics": {
"@schematics/angular:component": {
"prefix": "app",
"styleext": "css"
},
"@schematics/angular:directive": {
"prefix": "app"
}
}

now

"schematics": {
"@schematics/angular:component": {
"prefix": "app"
},
"@schematics/angular:directive": {
"prefix": "app"
}
}

it was mistake in word "styleext" - Intellij idea complain and highlight it (styleext or stylesheet is not allowed here). So after fix command : "ng g c component --skip-tests" became works properly

@farhankassam2
Copy link

In angular.json I had:

        "lint": {
          "builder": "@angular-eslint/builder:lint",
          "options": {
            "lintFilePatterns": [
              "src/**/*.ts",
              "src/**/*.html"
            ],
            "tsConfig": [
              "projects/px-visualizations/tsconfig.lib.json",
              "projects/px-visualizations/tsconfig.spec.json"
            ],
            "exclude": [
              "**/node_modules/**"
            ]
          }

and got

Schema validation failed with the following errors:
Data path "" should NOT have additional properties(tsConfig).

After upgrading from tslint to eslint. Luckely I was able to find this change in source control. It would be really helpful for the error to explain which invalid items are the issue.

        "lint": {
          "builder": "@angular-eslint/builder:lint",
          "options": {
            "lintFilePatterns": [
              "src/**/*.ts",
              "src/**/*.html"
            ]
          }

Fixed it. But I had no way other than guessing and reviewing source control to determine what the issue was.

I agree with @tamusjroyce above that the resolution to any error like this, is to simply remove declaring the variable that is being complained about in the source control in between the round brackets.

E.g., the error for me was as follows:

Schema validation failed with the following errors:
  Data path "" should NOT have additional properties(exclude).

This means that the property defined an a JSON object titled exclude in angular.json (as noted below) is invalid like so:
<project>/angular.json:

        "lint": {
          "builder": "@angular-eslint/builder:lint",
          "options": {
            "lintFilePatterns": [
              "src/**/*.ts",
              "src/**/*.html"
            ],
            "exclude": [
              "**/node_modules/**"
            ]
          }
        }

Removing the exclude definition, after my project was converted from using TSlint to ESLint, resolved the error message. Similar is to be said for issues other people had with other properties above like tsconfig or allowedCommonJsDependencies or es5BrowserSupport.

Cheers! :)

@stefanoschrs
Copy link

I had the same issue and for me the fix was to remove the buildOptimizer, vendorChunk from the build.configurations in angular.json.

So this:

"development": {
    "buildOptimizer": false,
    "vendorChunk": true,
    "optimization": false,
    "extractLicenses": false,
    "sourceMap": true,
    "namedChunks": true
}

Becomes this:

"development": {
    "optimization": false,
    "extractLicenses": false,
    "sourceMap": true,
    "namedChunks": true
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests