Your global Angular CLI version is greater than your local version
This tutorial guides you on how to fix Angular warning “Your global Angular CLI version is greater than your local version. The local Angular CLI version is used“.
Global Angular CLI version is greater than your local version
When you run ng serve command from your Angular project directory and if you get the warning like “Your global Angular CLI version (10.0.5) is greater than your local version (9.1.11). The local Angular CLI version is used” as shown below.
It means that Angular CLI version of your local workspace (9.1.11) is not matching with the global Angular CLI version (10.0.5)
> ng serve Your global Angular CLI version (10.0.5) is greater than your local version (9.1.11). The local Angular CLI version is used. chunk {main} main.js, main.js.map (main) 24.3 kB [initial] [rendered] chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 141 kB [initial] [rendered] chunk {runtime} runtime.js, runtime.js.map (runtime) 6.15 kB [entry] [rendered] chunk {styles} styles.js, styles.js.map (styles) 765 kB [initial] [rendered] chunk {vendor} vendor.js, vendor.js.map (vendor) 2.71 MB [initial] [rendered] Date: 2020-08-13T09:11:05.120Z - Hash: 2f98afd7e72983bfac50 - Time: 5687ms ** Angular Live Development Server is listening on localhost:4202, open your browser on http://localhost:4202/ ** : Compiled successfully.
To resolve the above warning or issue I had followed the below steps.
First, try to check Angular CLI version of your local workspace and the global one using the ng –version command.
C:\Users990\Documents\Nithi\Workspaces\Angular\udemy\my-app>ng --version Your global Angular CLI version (10.0.5) is greater than your local version (9.1.9). The local Angular CLI version is used. To disable this warning use "ng config -g cli.warnings.versionMismatch false". _ _ ____ _ ___ / \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _| / △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | | / ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | | /_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___| |___/ Angular CLI: 10.0.5 Node: 12.18.3 OS: win32 x64 Angular: 9.1.11 ... animations, common, compiler, compiler-cli, core, forms ... language-service, platform-browser, platform-browser-dynamic ... router Ivy Workspace: Yes Package Version ----------------------------------------------------------- @angular-devkit/architect 0.901.9 @angular-devkit/build-angular 0.1000.0 @angular-devkit/build-optimizer 0.1000.0 @angular-devkit/build-webpack 0.1000.0 @angular-devkit/core 9.1.9 @angular-devkit/schematics 9.1.9 @angular/cli 9.1.9 @ngtools/webpack 10.0.0 @schematics/angular 9.1.9 @schematics/update 0.901.9 rxjs 6.5.5 typescript 3.8.3 webpack 4.43.0
Therefore, from the above results it is clear that there is a issue with respect to Angular CLI version mismatch. To resolve this issue, first you need to uninstall the global version of Angular CLI using the following command.
>npm uninstall -g @angular/cli removed 280 packages in 2.229s
Then install the global version of angular CLI by specifying the exact version (@9.1.11) which matches your local workspace’s angular CLI with the following command.
>npm install -g @angular/[email protected] npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142 npm WARN deprecated [email protected]: this library is no longer supported C:\Users990\AppData\Roaming\npm\ng -> C:\Users990\AppData\Roaming\npm\node_modules\@angular\cli\bin\ng > @angular/[email protected] postinstall C:\Users990\AppData\Roaming\npm\node_modules\@angular\cli > node ./bin/postinstall/script.js + @angular/[email protected] added 281 packages from 206 contributors in 15.158s
You can also run the following command to ensure same version of angular CLI is installed in your local workspace too.
>npm install --save -dev @angular/[email protected] npm WARN install Usage of the `--dev` option is deprecated. Use `--only=dev` instead. > @angular/[email protected] postinstall C:\Users990\Documents\Nithi\Workspaces\Angular\udemy\my-app\node_modules\@angular\cli > node ./bin/postinstall/script.js npm WARN @angular-devkit/[email protected] requires a peer of @angular/compiler-cli@>=10.0.0-next.0 < 11 but none is installed. You must install peer dependencies yourself. npm WARN @angular-devkit/[email protected] requires a peer of typescript@>=3.9 < 3.10 but none is installed. You must install peer dependencies yourself. npm WARN @ngtools/[email protected] requires a peer of @angular/compiler-cli@>=10.0.0-next.0 < 11 but none is installed. You must install peer dependencies yourself. npm WARN @ngtools/[email protected] requires a peer of typescript@>=3.9 < 3.10 but none is installed. You must install peer dependencies yourself. npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}) npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\webpack-dev-server\node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}) npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\watchpack-chokidar2\node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}) + @angular/[email protected] added 4 packages from 6 contributors, removed 1 package, updated 11 packages and audited 1619 packages in 15.176s 50 packages are looking for funding run `npm fund` for details found 2 low severity vulnerabilities run `npm audit fix` to fix them, or `npm audit` for details
Then run ng –version command to check and verify whether angular CLI versions are matching.
>ng --version _ _ ____ _ ___ / \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _| / △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | | / ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | | /_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___| |___/ Angular CLI: 9.1.11 Node: 12.18.3 OS: win32 x64 Angular: 9.1.11 ... animations, cli, common, compiler, compiler-cli, core, forms ... language-service, platform-browser, platform-browser-dynamic ... router Ivy Workspace: Yes Package Version ----------------------------------------------------------- @angular-devkit/architect 0.901.11 @angular-devkit/build-angular 0.1000.0 @angular-devkit/build-optimizer 0.1000.0 @angular-devkit/build-webpack 0.1000.0 @angular-devkit/core 9.1.11 @angular-devkit/schematics 9.1.11 @ngtools/webpack 10.0.0 @schematics/angular 9.1.11 @schematics/update 0.901.11 rxjs 6.5.5 typescript 3.8.3 webpack 4.43.0
Finally, run ng serve command.
>ng serve chunk {main} main.js, main.js.map (main) 24.3 kB [initial] [rendered] chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 141 kB [initial] [rendered] chunk {runtime} runtime.js, runtime.js.map (runtime) 6.15 kB [entry] [rendered] chunk {styles} styles.js, styles.js.map (styles) 765 kB [initial] [rendered] chunk {vendor} vendor.js, vendor.js.map (vendor) 2.71 MB [initial] [rendered] Date: 2020-08-13T12:58:30.089Z - Hash: 2f98afd7e72983bfac50 - Time: 5511ms ** Angular Live Development Server is listening on localhost:4202, open your browser on http://localhost:4202/ ** : Compiled successfully.
Now, the warning “Global Angular CLI version is greater than your local version” is gone away ! Hope this helped 🙂
Also See:
- The difference between Constructor and ngOnInit in Angular 9
- String Interpolation in Angular 9
- Create a new component in Angular 9 with CLI and without CLI
- How to include Bootstrap to your Angular 9 Project ?
- Angular TypeScript Vs ES6 Vs ES5
- How to change angular port from 4200 to some other port ?
- Port 4200 is already in use while running ng serve Angular CLI command
- Data binding in Angular 9
- Cannot find module ‘@angular-devkit/build-angular’
- Error: This version of CLI is only compatible with Angular versions
- Angular 9 EventEmitter – Custom Events : Example