5

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...

4 Answers 4

10

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

Sign up to request clarification or add additional context in comments.

1 Comment

Check out darrhal's comment at github.com/angular/angular-cli/issues/5955 if unclear
2

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

Comments

1

Use NPX. Example of generating Angular project with version 5.0.0: npx -p @angular/[email protected] ng new projectName

After installing, the CLI will continue to use your local version.

Comments

-1

You can use the below way to lower down the version

npm uninstall -g angular-cli @angular/cli
npm cache clean
npm install -g @angular/cli@version_number
For example: npm install -g @angular/[email protected]

To check the version

ng -v

1 Comment

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.