简体   繁体   English

Angular2 ng构建无法正常工作

[英]Angular2 ng build not working properly

So i am using ng build in my angular2 project to create smaller folder size of my project called dist, but once i upload my project to my web host using file transfer protocol(Filezilla) it doesn't show my website. 所以我在我的angular2项目中使用ng build来创建名为dist的项目的较小文件夹大小,但是一旦我使用文件传输协议(Filezilla)将项目上传到我的虚拟主机,它就不会显示我的网站。 Is there some step i am still missing? 我还缺少一些步骤吗?

I will always follow steps to deploy my App 我将始终按照步骤部署我的应用

1) add script in the package.json 1)在package.json中添加脚本

"Prod_build": "ng build --base-href /yourappName/ --target=production --aot",

2) Run npm run Prod_build 2)运行npm运行Prod_build

3) copy your dist folder to your webhost. 3)将您的dist文件夹复制到您的虚拟主机。

对于产品构建,您需要运行

ng build --prod --aot --base-href /name/

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

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