angular-cli本地版本较低版本

bur*_*bak 3 systemjs webpack angular-cli angular

我在全球范围内安装了最新版本的angular-cli.版本如下.

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
Run Code Online (Sandbox Code Playgroud)

最近我开始尝试使用ng2-ngrx-store.所以我下载了一些示例应用程序.当我尝试构建它们时,我收到以下错误:

 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
Run Code Online (Sandbox Code Playgroud)

一种解决方案是将示例应用程序迁移到最新版本的angular-cli.但是我不想那样做,因为我只想学习ng2-ngrxstore.

所以,我的问题是......我可以在本地安装较低版本的angular-cli,以便我可以运行示例应用程序.如果有,怎么样?如果没有,我可以在某处使用新的angular-cli版本获得ngrxstore示例应用程序....

在此先感谢您的帮助...

Ahm*_*lam 6

您可以使用npm"scripts"使用与特定项目的dev依赖关系的angular-cli版本

当您从命令行运行"ng serve"时,它将使用您的全局包.但是如果你为每个应用程序的"package.json"添加一个"脚本","开始":"ng serve"并运行'npm start',这实际上将使用本地angular-cli(在该项目的node_modules文件夹中)

我相信"启动"脚本在angular-cli应用程序中是默认的


Pra*_*til -1

您可以使用以下方式降低版本

npm uninstall -g angular-cli @angular/cli
npm cache clean
npm install -g @angular/cli@version_number
For example: npm install -g @angular/cli@1.0.0-beta.19-4
Run Code Online (Sandbox Code Playgroud)

检查版本

ng -v
Run Code Online (Sandbox Code Playgroud)