本文介绍了我无法将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
发布评论