Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to resolve an 'Invalid format version detected - Expected:[ 1 ] Found: [ 3 ]' error when creating a component in Angular 8?

I need to create a component in my project in Angular 8, I tried the following command:

ng g c prueba

but it returned back an error as:

Invalid format version detected - Expected:[ 1 ] Found: [ 3 ]

Could you please help me to resolve it?

like image 707
andrestabares Avatar asked Jun 23 '19 21:06

andrestabares


1 Answers

Like in my comment above, I had a similar issue, except mine was reporting that it found 6 instead of 1. Anyway, by luck I took a look in the angular.json file and found that it has an element named version and it was set to 6. So I set it to 1 and the Angular gods smiled down upon me. It now works.

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "version": 1, // was 6
  ...
}

Now, I really don't know what that field value is for or why it works with 1 and not 6. Will I miss out on other features? No idea.

My Angular CLI version:

Angular CLI: 8.0.2
Node: 8.9.0
OS: win32 x64
Angular: 8.0.0
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... platform-server, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.800.1
@angular-devkit/build-angular     0.800.1
@angular-devkit/build-optimizer   0.800.1
@angular-devkit/build-webpack     0.800.1
@angular-devkit/core              8.0.1
@angular-devkit/schematics        8.0.2
@angular/cdk                      8.0.1
@angular/cli                      8.0.2
@angular/fire                     5.2.1
@angular/flex-layout              8.0.0-beta.26
@angular/http                     7.2.15
@angular/material                 8.0.1
@ngtools/webpack                  8.0.1
@schematics/angular               8.0.2
@schematics/update                0.800.2
rxjs                              6.5.2
typescript                        3.4.5
webpack                           4.30.0

ps: Hey Google, how about some better error messages? Even though this one seems accurate, it was still meaningless.

like image 138
Glaucus Avatar answered Sep 18 '22 11:09

Glaucus