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?

chadoulis
  • 383
  • 1
  • 3
  • 15

4 Answers4

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.

Murilo
  • 71
  • 1
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.

shehan96
  • 328
  • 1
  • 3
  • 20
  • Yes it works for me too.. but something is wrong. The short version like "ng g c something" should work :( – Itay Dec 13 '22 at 14:52
  • 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. – shehan96 Dec 15 '22 at 05:14
  • 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! – Itay Dec 15 '22 at 16:19
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

Jaafar Abbadi
  • 111
  • 1
  • 3
0

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

  • remove package-lock.json
  • npm install
  • npm update