angularjs/cli-Ng是命令无法正常工作 [英] angularjs/cli- Ng is command is not working as globle

查看:251
本文介绍了angularjs/cli-Ng是命令无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经安装了angular/cli,但是ng命令不能作为全局

I have installed the angular/cli but ng command is not working as global

C:\ Projects> ng -v 无法将"ng"识别为内部或外部命令, 可操作的程序或批处理文件.

C:\Projects>ng -v 'ng' is not recognized as an internal or external command, operable program or batch file.

推荐答案

按照以下步骤从有角度的CLI开始.

Follow the below steps to start with angular CLI.

第一个更新节点版本:

  1. 因此,首先通过键入命令node -v检查您的节点版本.
  2. 如果节点版本低于6.x.x,请进行更新,因为角度CLI要求节点版本高于6.x.x.要更新节点版本,请运行以下命令.

  1. So, first check your node version by typing command node -v.
  2. If node version is lower than 6.x.x then update it because angular CLI requires node version to be higher than 6.x.x. To update node version run the below command.

nvm install <new version> --reinstall-packages-from=<old version>

Ex: nvm install 7.10.0 --reinstall-packages-from=5.1.0

Ex: nvm install 7.10.0 --reinstall-packages-from=5.1.0

然后运行命令:nvm use 7.10.0

在此运行命令npm install -g @angular/cli之后,安装 Angular CLI .

After this run command npm install -g @angular/cli to install Angular CLI.

其他: 要将您的angular 2项目更新为angular 4项目,请运行以下命令:

Extra: To update your angular 2 project into angular 4 project run below command:

    * On Linux/Mac: npm install @angular/{common,compiler,compiler-cli,core,forms,http,platform-browser,platform-browser-dynamic,platform-    
                     server,router,animations}@next --save server,router,animations}@next --save

     * On Windows: npm install @angular/common@next @angular/compiler@next @angular/compiler-cli@next @angular/core@next 
                   @angular/forms@next @angular/http@next @angular/platform-browser@next @angular/platform-browser-dynamic@next 
                   @angular/platform-server@next @angular/  router@next @angular/animations@next --save

这篇关于angularjs/cli-Ng是命令无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆