简体   繁体   English

角度cli不起作用

[英]Angular cli is not working

currently i am learning angular4 . 目前我正在学习angular4。 So for this i install node js , then i do the following command in Node js commend prompt 因此,为此,我安装了节点js,然后在节点js推荐提示符下执行以下命令

npm install -g typescript
npm install -g @angular/cli@1.0.0
ng new --ng4 angullar-hello-world

By doing this , i created a angular project . 通过这样做,我创建了一个有角度的项目。 Then for run project i type 然后对于运行项目,我键入

ng serve

now the project run successfully http://localhost:4200 现在项目成功运行了http://localhost:4200

and in nod js command prompt the message is webpack: compiled successfully . 并在nod js命令提示符下显示消息为webpack: compiled successfully But after this i cannot type anything in command prompt . 但是之后,我无法在命令提示符下键入任何内容。 Command prompt and project is still working good , but i cannot type any word or command . 命令提示符和项目仍然可以正常运行,但是我无法键入任何单词或命令。 I am using windows 8 & Node v6.10.2 LTS . 我正在使用Windows 8和Node v6.10.2 LTS。

Please see the image Please any one can help 请看图片请任何人可以帮助

But after this i cannot type anything in command prompt 但是之后,我无法在命令提示符下键入任何内容

The program that waits for your input is called shell and when you type ng serve this shell program runs ng program and passes control to ng . 等待输入的程序称为shell ,当您键入ng serve该shell程序将运行ng program并将控制权传递给ng ng doesn't expect any input from you so you can't type in anything. ng不会收到您的任何输入,因此您无法输入任何内容。 In order to be able to input again you have to: 为了能够再次输入,您必须:

  1. either exit ng and pass control back to shell by pressing Ctrl+C , but this stops ng program. 或者退出ng并通过按Ctrl+C将控制权传递回shell ,但这会停止ng程序。
  2. run ng serve in background - START /B ng serve for Windows and long-ng serve & for Unix environments 在后台运行ng serve START /B ng serve为Windows和long-ng serve & Unix环境服务

See this answer for running programs in background in Windows. 有关在Windows中后台运行程序的信息,请参见此答案

From a web browser open http://localhost:4200 从网络浏览器中打开http:// localhost:4200

To kill the ngCli development server use ctrl+c in the command prompt. 要终止ngCli开发服务器,请在命令提示符下使用ctrl + c。

You won't be able to run other commands in the command prompt while the development server is running. 开发服务器运行时,您将无法在命令提示符下运行其他命令。 Simply open another command prompt to run other tasks. 只需打开另一个命令提示符即可运行其他任务。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM