如何在Angular 6+中的本地计算机上运行Dist文件夹? [英] How to run the Dist Folder on Local Machine in Angular 6+?
本文介绍了如何在Angular 6+中的本地计算机上运行Dist文件夹?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在Angular6+
中构建应用程序,现在我运行了ng build --prod
命令,该命令给了我一个dist文件夹.现在如何在Localhost上检查或提供该文件夹?
I am building the application in Angular6+
, now I have run the command ng build --prod
which gave me a dist folder. Now how to 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屋!
查看全文