An unhandled exception occurred: NOT SUPPORTED: keyword "id", use "$id" for schema ID
Asked Answered
B

4

10

When running ng deploy I get the following error:

An unhandled exception occurred: NOT SUPPORTED: keyword "id", use "$id" for schema ID
See "C:\Users\theoh\AppData\Local\Temp\ng-Nv0wMh\angular-errors.log" for further details.

The full log of the error is the following:

[error] Error: NOT SUPPORTED: keyword "id", use "$id" for schema ID
    at Object.code (D:\code\brain-consulting\bbc\node_modules\@angular\cli\node_modules\ajv\dist\vocabularies\core\id.js:6:15)
    at keywordCode (D:\code\brain-consulting\bbc\node_modules\@angular\cli\node_modules\ajv\dist\compile\validate\index.js:454:13)
    at D:\code\brain-consulting\bbc\node_modules\@angular\cli\node_modules\ajv\dist\compile\validate\index.js:222:17
    at CodeGen.code (D:\code\brain-consulting\bbc\node_modules\@angular\cli\node_modules\ajv\dist\compile\codegen\index.js:439:13)
    at CodeGen.block (D:\code\brain-consulting\bbc\node_modules\@angular\cli\node_modules\ajv\dist\compile\codegen\index.js:568:18)
    at iterateKeywords (D:\code\brain-consulting\bbc\node_modules\@angular\cli\node_modules\ajv\dist\compile\validate\index.js:219:9)
    at groupKeywords (D:\code\brain-consulting\bbc\node_modules\@angular\cli\node_modules\ajv\dist\compile\validate\index.js:208:13)
    at D:\code\brain-consulting\bbc\node_modules\@angular\cli\node_modules\ajv\dist\compile\validate\index.js:192:13
    at CodeGen.code (D:\code\brain-consulting\bbc\node_modules\@angular\cli\node_modules\ajv\dist\compile\codegen\index.js:439:13)
    at CodeGen.block (D:\code\brain-consulting\bbc\node_modules\@angular\cli\node_modules\ajv\dist\compile\codegen\index.js:568:18)

I tried ng add @angular-eslint/schematics@next as suggested here but it did not work. The versions I use are the following:

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1300.3
@angular-devkit/build-angular   13.0.3
@angular-devkit/core            13.0.3
@angular-devkit/schematics      13.0.3
@angular/cli                    13.0.3
@angular/fire                   7.0.2
@nguniversal/builders           13.0.1
@nguniversal/express-engine     13.0.1
@schematics/angular             13.0.3
rxjs                            6.6.7
typescript                      4.4.4

Any suggestions?

Backblocks answered 19/11, 2021 at 13:31 Comment(0)
C
7

I had the same problem. In my case, it was caused by @angular-builders/custom-webpack that was not updated during ng update. So manually updating it from version 10.0.1 to ^13.0.0 solved the problem.

Castaway answered 26/11, 2021 at 12:44 Comment(0)
D
2

In my angular project when I am trying to create a service like this

ng g s folder-name/folder-name/service-name

I got this error from angular cli

An unhandled exception occurred: NOT SUPPORTED: keyword "id", use "$id" for schema ID
See "/private/var/folders/fw/5mkxql_j6c33ssny9wj1w1g80000gn/T/ng-ixUrL3/angular-errors.log" for further details.

Therefore I run CLI commands without using alias s - services like this : Used full name

ng generate service folder-name/folder-name/service-name

Above again in the CLI command works for me. Hope this trick helps you as well.

Dorey answered 23/8, 2022 at 8:50 Comment(3)
Yes it works for me too.. but something is wrong. The short version like "ng g c something" should work :(Duration
Yes, that's true. short version should work. I'm trying to find why it is not working. May be it is Angular CLI issue or bug.Dorey
I found my bug - I use a state management package called Akita - it comes with its own cli commands - I upgraded it and the problem is solved!Duration
B
0

Try removing the package-lock file "if its safe to do so" & the node modules folder. then in the package.json file change "jasmine-core": "~3.6.0" to "jasmine-core": "~3.8.0" Then hit npm install. it worked for me

Backrest answered 6/12, 2021 at 15:10 Comment(1)
there are commands for updating/upgrading packagesTso
C
0

This is what I've done to solve this issue:

  • remove package-lock.json
  • npm install
  • npm update
Chromosphere answered 29/9, 2022 at 17:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.