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.
推荐答案
按照以下步骤开始使用 angular CLI.
Follow the below steps to start with angular CLI.
第一次更新节点版本:
- 因此,首先通过键入命令
node -v
来检查您的节点版本. 如果节点版本低于 6.x.x,则更新它,因为 angular 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 <新版本>--reinstall-packages-from=<旧版本>
例如: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屋!