英文:
VS 2022 stuck on running Angular application
问题
我使用VS 2022进行VB.NET编程。昨天,我开始学习Angular的教程。选择了类型为Standalone Typescript Angular Project的新项目。它将启动文件添加到了项目中。然后,我按下F5运行它。一个命令窗口打开并显示消息。同时,一个Chrome窗口显示欢迎页面。我关闭了它们两个,然后对app.component.html的标题文本进行了一些小改动,尝试再次运行。现在,命令提示符打开并停在"Complied successfully"(编译成功)处。Chrome不会打开。底部的状态栏显示"Deploy started"(启动部署)。
是的,我可以手动打开浏览器访问http://localhost:4200并看到我的更改。
但是,为什么会停在这一点上?
英文:
I use VS 2022 for VB.NET programming. Yesterday, I started the tutorial for Angular. Selected new project of type Standalone Typescript Angular Project. It added the startup files into the project. I then pressed F5 to run it. A command window opened with messages. Also, a Chrome window with the welcome page. I closed both of them and made one small change to the title text of app.component.html and tried running again. Now, the command prompt opens and gets stuck at "Complied successfully". Chrome doesn't open. The status bar at the bottom says "Deploy started".
Yes, I can manually open browser to http://localhost:4200 and see me change.
But, why is it stuck at this point?
答案1
得分: 2
这里是翻译好的部分:
- 不会在那一点卡住。
- 使用 VS 2022 运行程序只会启动命令提示符,并在根目录中执行命令 "ng serve" 以启动 Angular 应用程序。
- 第一次启动命令提示符并执行了 "ng serve -o" 命令(启动 Angular 应用并打开窗口)。这可能可以在设置中更改。
- 无论如何,它应该具有 "热重载" 的功能,这意味着它应该能够在不重新启动的情况下反映对程序的更改。(也许仍然需要在设置中打开它)。
英文:
It's not stuck at that point.
Running the program using VS 2022 will just launch a command prompt and perform the command "ng serve" in the root-folder to launch the angular application.
The first time it launched the command prompt and performed the.
ng serve -o command (launch Angular app and open window). It can probably be changed in the settings.
Anyway It should have "hot-reloading" meaning it should reflect the changes to your program without restarting. (maybe it still needs to be turned on in the settings).
答案2
得分: 2
这是为了 ng serve 设计的,正如其他人所述。实时重新加载应该能够检测到保存的更改,并在更改成功编译时重新加载页面。如果出现编译错误,您也会在该窗口中看到它
如果您想禁用自动重新加载,请查看此帖子:https://stackoverflow.com/questions/39566999/angular-cli-how-to-disable-auto-reload-when-ng-serve
英文:
As others have stated, this is intended for ng serve. Live reloading should detect saved changes and reload the page if the change compiles successfully. If you have a compilation error, you'll see it in that window as well
If you want to disable auto reloading look at this post: https://stackoverflow.com/questions/39566999/angular-cli-how-to-disable-auto-reload-when-ng-serve
答案3
得分: 1
现在,命令提示符打开并卡在“成功编译”处。Chrome没有打开。底部状态栏显示“部署已启动”。
这并不是“卡住”。它的行为完全符合设计。每次您在Angular应用程序中进行更改并保存更改时,您会看到这些更改反映在命令提示符窗口中。它会构建您的更改并在每次成功编译时通知您。
您不必关闭窗口!您可以简单地刷新您的页面。(附言:在Chrome的开发工具中,请确保“禁用缓存”如果您正在对已缓存的内容进行更改。)
您正在完全正确的道路上!
英文:
> Now, the command prompt opens and gets stuck at "Complied
> successfully". Chrome doesn't open. The status bar at the bottom says
> "Deploy started".
This is not "stuck". It is behaving exactly as designed. Every change you make you will see reflected in the command prompt window. It will build your changes and let you know whether it compiled successfully each time you make and save a change in your angular application.
You do not have to close your window! You can simply refresh your page. (P.S.: In your dev tools on chrome, make sure to "disable cache" if you are making changes to things that are cached.)
You are on the exact right track!
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论