我无法将Angular应用部署到heroku

编程入门 行业动态 更新时间:2024-10-28 01:24:55
本文介绍了我无法将Angular应用部署到heroku的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在尝试在Heroku上部署我的angular 6应用, 构建项目并完成所有部署步骤后,我在heroku上获得了此结果:

I am trying to deploy my angular 6 app on Heroku, After building the project and following all the steps of deploy, I get this result on heroku:

和Heroku日志是:

and th Heroku logs is :

在测试部署地址时,我们得到以下结果:

when testing the deploy address, we get this result:

我们非常感谢您的帮助

推荐答案

您将必须在server.js中将通配符get路由添加为:

You will have to add wildcard get route in server.js as:

app.use(express.static(__dirname + '/dist')); app.get('/*', function(req, res) { res.sendFile(path.join(__dirname + '/dist/index.html')); });

解决方案2

在dist文件夹中添加一个index.php文件,在其中添加以下代码:

add one index.php file in dist folder add following code in it:

<?php header( 'Location: /index.html' ) ; ?>

它将部署您的应用程序.

It will deploy your application.

更多推荐

我无法将Angular应用部署到heroku

本文发布于:2023-10-28 02:12:58,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1535205.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Angular   heroku

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!