angular-cli lower version locally

12,946

Solution 1

You can use the angular-cli version that is a dev-dependency for the specific project by using npm "scripts"

When you run 'ng serve' from command line, it uses your global package. But if you add a "script" to "package.json" of each application, "start":"ng serve" and run 'npm start' this will actually use the local angular-cli ( in that project's node_modules folder)

I believe that "start" scripts is default in angular-cli applications

Solution 2

do npm start on your project which is equivalent to ng serve. it will run your local angular version.

Share:
12,946
burbak
Author by

burbak

a full stack developer

Updated on June 13, 2022

Comments

  • burbak
    burbak about 2 years

    I have a recent version of angular-cli installed globally. The version is as follows.

    C:\Users\W055013\kumar\learn\rx>ng --version
    As a forewarning, we are moving the CLI npm package to "@angular/cli" with the next release,
    which will only support Node 6.9 and greater. This package will be officially deprecated
    shortly after.
    
    To disable this warning use "ng set --global warnings.packageDeprecation=false".
    
    
                                 _                           _  _
      __ _  _ __    __ _  _   _ | |  __ _  _ __         ___ | |(_)
     / _` || '_ \  / _` || | | || | / _` || '__|_____  / __|| || |
    | (_| || | | || (_| || |_| || || (_| || |  |_____|| (__ | || |
     \__,_||_| |_| \__, | \__,_||_| \__,_||_|          \___||_||_|
                   |___/
    angular-cli: 1.0.0-beta.28.3
    node: 6.9.1
    os: win32 x64
    

    Recently I started to experiment with ng2-ngrx-store. So I downloaded a few sample applications. When I try to build them I get the following errors:

     C:\Users\W055013\kumar\learn\rx\staffer\staffer-ng2-ngrxstore>ng build
        As a forewarning, we are moving the CLI npm package to "@angular/cli" with the next release,
        which will only support Node 6.9 and greater. This package will be officially deprecated
        shortly after.
    
    To disable this warning use "ng set --global warnings.packageDeprecation=false".
    
    
    It seems like you're using a project generated using an old version of the Angular CLI.
    The latest CLI now uses webpack and has a lot of improvements including a simpler
    workflow, a faster build, and smaller bundles.
    
    To get more info, including a step-by-step guide to upgrade the CLI, follow this link:
    https://github.com/angular/angular-cli/wiki/Upgrading-from-Beta.10-to-Beta.14
    

    One solution is to migrate the sample applications to the recent version of angular-cli. However I do not want to do that as I just want to learn ng2-ngrxstore.

    So, my question is ... can I install a lower version of angular-cli locally so that I can run the sample application. If yes , how ? if no can I get ngrxstore sample applications with the new angular-cli version somewhere....

    Thanks in advance for your help...

  • burbak
    burbak over 7 years
    my question was about having a different version gloablly and locally. is it possible? And also I could not install a old lower version globally too. It suggests a list of recent lower versions to be installed as follows: C:\Users\W055013\kumar\learn\rx\staffer>npm install -g pm ERR! notarget No compatible version found: @angular/[email protected] npm ERR! notarget Valid install targets: npm ERR! notarget 1.0.0-beta.32.3, 1.0.0-beta.32.2, 1.0.0-beta.32, 1.0.0-beta.31, 1.0.0-beta.30, 1.0.0-beta.29, 1.0.0-beta.28.3
  • S. Robijns
    S. Robijns about 6 years
    Check out darrhal's comment at github.com/angular/angular-cli/issues/5955 if unclear