如何在 Angular 6+ 的本地机器上运行 Dist 文件夹? [英] How to run the Dist Folder on Local Machine in Angular 6+?
本文介绍了如何在 Angular 6+ 的本地机器上运行 Dist 文件夹?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在 Angular6+
中构建应用程序,现在我运行了命令 ng build --prod
,它给了我一个 dist 文件夹.如何在本地主机上检查或提供该文件夹?
I am building the application in Angular6+
, now I ran the command ng build --prod
which gave me a dist folder. How do I check or serve that folder on Localhost?
推荐答案
你可以使用 http 做到这一点-server 包.
首先安装包全局
npm install http-server -g
然后在您的项目目录中(在终端中)运行
Then inside your project directory(in the terminal) just run
http-server dist/
如果您使用的是 Angular 6+ 或更高版本(使用 Angular 10),您必须运行
And if you are using Angular 6+ or above (Working with Angular 10), You have to run
http-server dist/your-project-name
现在您可以访问http://localhost:8080查看您的申请
Now you can visit http://localhost:8080 to view your application
这篇关于如何在 Angular 6+ 的本地机器上运行 Dist 文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文