11

i've installed the latest angular-cli on a fresh machine and i'm trying to serve a project generated with a previous cli version

i got this warning

Your global Angular CLI version (1.6.4) is greater than your local
version (1.6.3). The local Angular CLI version is used.

To disable this warning use "ng set --global warnings.versionMismatch=false".

Although the project works correctly what have i do in order to update my project with latest dependecies and avoid this message (avoid not suppress!)

this is my package.json

{
    "name": "AngularTest",
    "version": "0.0.0",
    "license": "MIT",
    "angular-cli": {},
    "scripts": {
        "ng": "ng",
        "start": "ng serve --host 0.0.0.0 --port 4200",
        "hmr": "ng serve --host 0.0.0.0 --port 4200 4201 --hmr -e=hmr",
        "test": "ng test",
        "pree2e": "webdriver-manager update --standalone false --gecko false",
        "e2e": "protractor"
    },
    "private": true,
    "dependencies": {
        "@angular/animations": "^5.0.3",
        "@angular/common": "^5.0.3",
        "@angular/compiler": "^5.0.3",
        "@angular/core": "^5.0.3",
        "@angular/forms": "^5.0.3",
        "@angular/http": "^5.0.3",
        "@angular/platform-browser": "^5.0.3",
        "@angular/platform-browser-dynamic": "^5.0.3",
        "@angular/router": "^5.0.3",
        "@aspnet/signalr-client": "1.0.0-preview1-27891",
        "@types/bootstrap": "^3.3.33",
        "@types/jquery": "^3.2.12",
        "@types/jquery.blockui": "0.0.28",
        "@types/jquery.validation": "^1.16.3",
        "@types/lodash": "^4.14.62",
        "@types/moment": "^2.13.0",
        "@types/moment-timezone": "^0.2.34",
        "@types/signalr": "^2.2.33",
        "@types/toastr": "^2.1.33",
        "abp-ng2-module": "^1.3.0",
        "abp-web-resources": "^3.3.0",
        "animate.css": "^3.5.2",
        "block-ui": "^2.70.1",
        "bootstrap": "^3.3.7",
        "bootstrap-select": "^1.12.2",
        "chart.js": "^2.6.0",
        "core-js": "^2.4.1",
        "famfamfam-flags": "^1.0.0",
        "flot": "^0.8.0-alpha",
        "font-awesome": "^4.7.0",
        "jquery": "^3.1.1",
        "jquery-countto": "^1.2.0",
        "jquery-migrate": "^3.0.0",
        "jquery-slimscroll": "^1.3.8",
        "jquery-sparkline": "^2.4.0",
        "js-cookie": "^2.1.4",
        "lodash": "^4.17.4",
        "moment": "^2.18.1",
        "moment-timezone": "^0.5.13",
        "morris.js": "^0.5.0",
        "ngx-bootstrap": "^1.6.6",
        "ngx-pagination": "^3.0.0",
        "node-waves": "^0.7.5",
        "push.js": "1.0.4",
        "raphael": "^2.2.7",
        "rxjs": "^5.5.2",
        "signalr": "^2.2.1",
        "simple-line-icons": "^2.4.1",
        "spin.js": "^2.3.2",
        "sweetalert": "^2.0.8",
        "toastr": "^2.1.2",
        "ts-helpers": "^1.1.2",
        "web-animations-js": "^2.3.1",
        "zone.js": "0.8.18"
    },
    "devDependencies": {
        "@angular/cli": "^1.5.4",
        "@angular/compiler-cli": "^5.0.3",
        "@angularclass/hmr": "^2.1.3",
        "@types/jasmine": "^2.5.38",
        "@types/node": "^8.0.27",
        "codelyzer": "^3.1.2",
        "jasmine-core": "^2.5.2",
        "jasmine-spec-reporter": "^4.2.1",
        "karma": "^1.4.1",
        "karma-chrome-launcher": "^2.0.0",
        "karma-cli": "^1.0.1",
        "karma-coverage-istanbul-reporter": "^1.3.0",
        "karma-jasmine": "^1.1.0",
        "karma-jasmine-html-reporter": "^0.2.2",
        "nswag": "^11.12.7",
        "protractor": "^5.1.1",
        "ts-node": "^3.3.0",
        "tslint": "^5.7.0",
        "typescript": "2.4.2"
    }
}
pinale
  • 2,060
  • 6
  • 38
  • 72
  • 6
    Possible duplicate of [Global Angular CLI version greater than local version](https://stackoverflow.com/questions/44525746/global-angular-cli-version-greater-than-local-version) – JSON Derulo Jan 18 '18 at 08:16
  • Instead of upgrading all of my packages, I would rather downgrade my CLI version. –  Jan 18 '18 at 08:23
  • use this solution for upgrade and update your `Angular-cli`: https://stackoverflow.com/questions/43931986/how-to-upgrade-angular-cli-to-the-latest-version/48294993#48294993 – Hasan Fathi Jul 19 '18 at 07:41

7 Answers7

4

The warning shows that your local app cli version is lower than your global cli version. So if you want to stop that warning you need to locally install specific angular cli version.

Use this command

npm install --save @angular/cli@wished.version.here

In your case

npm install --save @angular/cli@1.6.4

lazzy_ms
  • 1,169
  • 2
  • 18
  • 40
Aarsh
  • 2,555
  • 1
  • 14
  • 32
3

Your global Angular CLI version (6.0.0) is greater than your local version (1.6.1). The local Angular CLI version is used

You can update local version to latest by using:

npm uninstall --save-dev angular/cli
npm install --save-dev @angular/cli@latest
npm install

to verify version

  ng --version
ale10ander
  • 942
  • 5
  • 22
  • 42
Hemanth Kumar
  • 809
  • 1
  • 7
  • 7
2

You Need to upgrade your project user CLI version. I recommend to take backup, then: 1- Make sure you are in your project folder. 2- Run

ng update --all

to update all packages, or you can run

ng update @angular/core

for Upgrading Core Packages only, but I recommend upgrading all packages.

After this you can run your application as normal.

Anas Naguib
  • 1,006
  • 11
  • 12
1

I had the same issue. I manually updated the package.json to "@angular/cli": "^6.0.0" and also deleted the node_modules/@angular/cli module, before issuing npm install @angular/cli.

That solved the issue.

1

If your getting this message

"Your global Angular CLI version (6.0.0) is greater than your local version (1.6.1). The local Angular CLI version is used".

You just need to update your local version to the global version.

First type the command npm uninstall --save-dev angular/cli

Let it uninstall the current version

Then npm install --save-dev @angular/cli@latest

Now it has been updated to the latest version. To check that simply run the command ng --version

Now all set... Go to the terminal and type ng serve

Thanks, Gani

1

The installed local Angular CLI version is older than the latest stable version. Installed a temporary version to perform the update.

solution

npm install --save @angular/cli@(latest version) -g

If we suppose we want the Angular version 10.2.0 We will write the command:

npm install --save @angular/cli@10.2.0 -g
Sarah
  • 331
  • 3
  • 3
0

️ install the latest version of the Angular CLI locally

npm install @angular/cli@latest --save-dev

️ install the latest version of the Angular CLI globally

npm install -g @angular/cli@latest

if errors persists

️ delete node_modules and package-lock.json (Windows)

rd /s /q "node_modules"
del package-lock.json
del -f yarn.lock

️ delete node_modules and package-lock.json (macOS/Linux)

rm -rf node_modules
rm -f package-lock.json
rm -f yarn.lock

️ clean npm cache

npm cache clean --force

npm install
Mykhailo
  • 26
  • 3