how to downgrade Angular-cli version?

I'm new in Angular 4 and i have face this error,

Your global Angular CLI version (6.0.1) is greater than your local
version (1.4.1). The local Angular CLI version is used.

can you please help me in solving this ?

4 answers

  • answered 2018-05-16 06:11 Ritwick Dey

    npm uninstall -g @angular/cli
    npm cache clean
    npm install -g @angular/cli@1.4.1
    

  • answered 2018-05-16 06:13 Sangwin Gawande

    Your project always uses CLI version on which you have created the project. You can see it in the warning while running ng serve. If global version is greater than Local version then local version is used.

    It is also defined in your package.json file.

    "devDependencies": {
        "@angular/cli": "1.5.0",
         ....
    } 
    

    CLI warning

    If you really want then you can downgrade your global angular-cli installation to eg. 1.4.1 by running following commands on terminal:

    npm uninstall -g angular-cli
    npm cache clean
    npm install -g angular-cli@1.4.1
    

    Complete Upgrade and Downgrade guide is on GitHub README.

    Referenced From

  • answered 2018-05-16 06:22 NitinSingh

    1) Do you have other projects which are using angular (and what version of CLI are they using)

    2) Once you identify which version you want to retain, you can uninstall the current version by

    global:

    npm uninstall -g @angular/cli
    

    or local

    npm uninstall @angular/cli
    

    3) Then install desired version in the same scope as you uninstalled (making sure of any dependencies with other components)

    global

    specific version

    npm install -g @angular/cli@1.4.1
    

    latest version

    npm install -g @angular/cli
    

    local Same as global but without the "-g" flag

    Ideally the versions should be latest unless you figure out any compatibility issues

    Edit:

    Angular CLI 6.xxx

    has a breaking change of "angular.json" in new vs ".angular.json" in old (difference of dot in file name). Use Error: Local workspace file ('angular.json') could not be found if moving to angular 6

  • answered 2018-05-16 08:49 chandrakant

    if you are using windows then uninstall node.js then re-install then install @angular/cli ,npm update and then npm install , hope its working