简体   繁体   English

Heroku上的MERN应用

[英]MERN app on Heroku

I'm trying to get mern app working on heroku. 我正在尝试让heroku上的mern应用程序正常工作。 But right now even fixing of node server would be enough. 但是现在,即使修复节点服务器也已足够。

This is what i have already done. 这就是我已经做过的。

  1. Created app in heroku and push my project to it. 在heroku中创建了应用,然后将我的项目推送到该应用。
  2. Added mLab database link. 添加了mLab数据库链接。 (running properly on local server) (在本地服务器上正常运行)
  3. put dev dependencies on the dependencies. 将开发依赖项放在依赖项上。
  4. Tried running "heroku run node server.js" through heroku CLI. 尝试通过heroku CLI运行“ heroku运行节点server.js”。 Then it logs as server started on port 8080. 然后,它将在服务器在端口8080上启动时记录日志。

But I cannot access the API or the web interface. 但是我无法访问API或Web界面。 My app url = http://travelaround.herokuapp.com 我的应用程序网址= http://travelaround.herokuapp.com

Please note my web application was create using create-react-app My Logs at heroku, 请注意,我的Web应用程序是使用heroku上的create-react-app我的日志创建的

 2017-05-14T17:17:50.113754+00:00 heroku[api.1]: Process exited with status 0 2017-05-14T17:17:52.979224+00:00 heroku[api.1]: Starting process with command `nodemon server.js` 2017-05-14T17:17:53.538796+00:00 heroku[api.1]: State changed from starting to up 2017-05-14T17:17:55.154398+00:00 app[api.1]: [33m[nodemon] 1.11.0[39m 2017-05-14T17:17:55.156364+00:00 app[api.1]: [33m[nodemon] to restart at any time, enter `rs`[39m 2017-05-14T17:17:55.156522+00:00 app[api.1]: [33m[nodemon] watching: *.*[39m 2017-05-14T17:17:55.157062+00:00 app[api.1]: [32m[nodemon] starting `node server.js`[39m 2017-05-14T17:17:55.982045+00:00 app[api.1]: Database connection Established at mongodb://test:asd123@ds139791.mlab.com:39791/travelaround 2017-05-14T17:17:56.008148+00:00 app[api.1]: api running on port 3000 2017-05-15T14:22:19.692618+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=travelaround.herokuapp.com request_id=b46a031e-db9d-4cac-93fa-ffd73f51e5f3 fwd="93.65.70.107" dyno= connect= service= status=503 bytes= protocol=http 2017-05-15T14:22:20.297803+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=travelaround.herokuapp.com request_id=9ca4977c-b45e-4f3e-b98a-1034855e8c4f fwd="93.65.70.107" dyno= connect= service= status=503 bytes= protocol=http 
资源选项卡的屏幕截图

Ok, so from the screenshot of your Heroku dashboard and error, it looks like your dynos are not running. 好的,因此从Heroku仪表板和错误的屏幕截图来看,您的dynos似乎没有运行。 I suggest you compile all of your react code, so you only have static content on your frontend, and then turn on the API dyno, so you can actually curl to it from your react code. 我建议您编译所有的React代码,这样您的前端只有静态内容,然后打开API dyno,这样您就可以从您的React代码中卷曲它了。

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

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