Update: Invalid format version detected - Expected:[ 1 ] Found: [ 2 ]
See original GitHub issueCurrent Behavior
I cannot force run NG update.
Expected Behavior
Work as described:
Steps to Reproduce
FORCE_NG_UPDATE=true pnpm nx (or ng) update @angular/{cli,core,cdk,google-maps}@latest --allow-dirty
I do not use the decorate js file because it seems odd and I never use ng commands except for this one. Sometimes this works but sometimes I get this error. Have not found out yet in which condition it works.
Failure Logs
[NX] Angular devkit readJsonWorkspace fell back to Nx workspaces logic
The installed Angular CLI version is outdated.
Installing a temporary Angular CLI versioned 14.1.0 to perform the update.
✔ Packages successfully installed.
Node.js version v17.9.1 detected.
Odd numbered Node.js versions will not enter LTS status and should not be used for production. For more information, please see https://nodejs.org/en/about/releases/.
Workspace config file cannot be loaded: /Users/marvin/Development/app/angular.json
Invalid format version detected - Expected:[ 1 ] Found: [ 2 ]
ELIFECYCLE Command failed with exit code 1.
FORCE_NG_UPDATE=true pnpm ng update @angular/{cli,core,cdk,google-maps}@latest --allow-dirty
Node.js version v17.9.1 detected.
Odd numbered Node.js versions will not enter LTS status and should not be used for production. For more information, please see https://nodejs.org/en/about/releases/.
Workspace config file cannot be loaded: /Users/marvin/Development/app/angular.json
Invalid format version detected - Expected:[ 1 ] Found: [ 2 ]
Environment
Node : 17.9.1
OS : darwin arm64
pnpm : 7.5.2
nx : 14.4.3
@nrwl/angular : 14.4.3
@nrwl/cypress : 14.4.3
@nrwl/detox : Not Found
@nrwl/devkit : 14.4.3
@nrwl/eslint-plugin-nx : 14.4.3
@nrwl/express : Not Found
@nrwl/jest : 14.4.3
@nrwl/js : 14.4.3
@nrwl/linter : 14.4.3
@nrwl/nest : Not Found
@nrwl/next : Not Found
@nrwl/node : Not Found
@nrwl/nx-cloud : Not Found
@nrwl/nx-plugin : Not Found
@nrwl/react : Not Found
@nrwl/react-native : Not Found
@nrwl/schematics : Not Found
@nrwl/storybook : 14.4.3
@nrwl/web : 14.4.3
@nrwl/workspace : 14.4.3
typescript : 4.7.3
---------------------------------------
Community plugins:
@ionic/angular: 6.1.14
@ngneat/transloco: 4.1.1
ngx-extended-pdf-viewer: 14.5.0
@compodoc/compodoc: 1.1.19
@ionic/angular-toolkit: 7.0.0
@nxtend/capacitor: 13.0.0
@nxtend/ionic-angular: 13.1.0
@testing-library/angular: 12.1.0
nx-stylelint: 13.5.2
Issue Analytics
- State:
- Created a year ago
- Comments:10 (5 by maintainers)
Top Results From Across the Web
angular7 - How to resolve an 'Invalid format version detected
Anyway, by luck I took a look in the angular.json file and found that it has an element named version and it was...
Read more >Discussion on Assist - Angular 13+ Bootstrap 5+ Theme
... v2.0 folder and running ng serve command I am getting error: "An unhandled exception occurred: Invalid format version detected - Expected:[ 1...
Read more >Angular Schematics not loading when using version 2 of ...
Angular Schematics not loading when using version 2 of angular.json (NX workspace). 2. Using version 2: image.png. Using version 1: image1.png.
Read more >Intro to Nx
A modern Angular development experience powered by advanced generators and integrations with modern tooling. Create a Standalone Angular app. Adopting Nx.
Read more >Angular workspace configuration
Angular CLI comes with two build configurations: production and development . By default, the ng build command uses the production configuration, which applies ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Sure, let me clarify:
That is the command that we would recommend, but for @angular/core or other angular packages we don’t tend to recommend it due to the potential incompatibilities between new versions of @angular-devkit/core and Nx. The reasoning for that is explained a bit in the rest of that paragraph above.
There isn’t a feud, we collaborate with the angular team on several things and that’s certainly not the takeaway that I am trying to give. The end result is that an Nx workspace is an Nx workspace, not an Angular CLI workspace. An Nx workspace that uses v1 schema for workspace configuration is backwards compatible with Angular CLI, where as an Nx workspace that uses v2 schema or standalone configuration files is no longer backwards compatible with the raw Angular CLI since that is a feature of the Nx CLI tool. When invoking Angular CLI outright, only features that it supports are supported. FORCE_NG_UPDATE disables any compatibility layers that we have in place when using Nx CLI, and thus fails now.
Sorry but:
sounds confusing to me. What do you not generally recommend? Updating an especific package to an especific version using nx migrate?
It seems like some kind of a feud; wifh NX and Angular users trying to code in the middle of the battlefield. Anyway, there’s no other option than going with those workarounds and I’m happy, less frustrated, to know it.
Even this message can be read in ugly ways, I really apreciate your guidance.
Take it as a fresh view from a new NX user who isn’t still used to the details. It can be a fresh view for those who are immersed in NX uses and standards.