angularjs/cli-Ng是命令无法正常工作 [英] angularjs/cli- Ng is command is not working as globle
问题描述
我已经安装了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.
第一个更新节点版本:
- 因此,首先通过键入命令
node -v
检查您的节点版本. -
如果节点版本低于6.x.x,请进行更新,因为角度CLI要求节点版本高于6.x.x.要更新节点版本,请运行以下命令.
- So, first check your node version by typing command
node -v
. 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屋!