Getting error when i deploy vue app to heroku

感情迁移 提交于 2020-01-16 08:47:07

问题


I have a vuejs app which set up with vue cli, and i'm trying deploy my app to heroku.

Here's my server :

const express = require('express');
const port = process.env.PORT || 8080;

const app = express();

app.use(express.static(__dirname + "/dist/"));
app.get(/.*/ , function(req,res) {
  res.sendfile(__dirname + "/dist/index.html");
});

app.listen(port);

console.log("Server started..."); 

  • I remove dist from gitignore,
  • I aded a start point like "start": "node server.js" in package.json

Here's what i see on console :

Failed to load resource: the server responded with a status of 503 (Service Unavailable) /favicon.ico:1

Here's heroku logs :

2019-12-13T08:55:49.464914+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=followgoals.herokuapp.com request_id=09df33ae-96ab-415a-929b-530fb943318d fwd="37.130.123.179" dyno= connect= service= status=503 bytes= protocol=https 2019-12-13T08:55:49.828341+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=followgoals.herokuapp.com request_id=21de7307-502e-4104-a648-8e6b0832a3fe fwd="37.130.123.179" dyno= connect= service= status=503 bytes= protocol=https

So what can i do the fix problem ?


回答1:


I had the same problem, worked on local, 503 error on heroku, and I fixed it by going to my db cloud service(mongodb atlas), and changed the white list setting on my cluster from "home" to "anywhere".

https://www.youtube.com/watch?v=leNNivaQbDY&t=31s



来源:https://stackoverflow.com/questions/59319358/getting-error-when-i-deploy-vue-app-to-heroku

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!