How do I deploy an Angular.js app?

后端 未结 3 1946
青春惊慌失措
青春惊慌失措 2021-02-05 12:38

This may be a stupid question, but I\'m wondering what platform I should use to deploy my Angular.js app? I tried using Heroku but got a \"no Cedar-supported app detected\" erro

3条回答
  •  旧时难觅i
    2021-02-05 13:12

    I bet if you look at your logs you'll see something like this:

    2013-08-26T12:51:18.257006+00:00 heroku[web.1]: Starting process with command `node scripts/web-server.js`
    2013-08-26T12:51:19.109974+00:00 app[web.1]: Http Server running at http://localhost:8000/
    2013-08-26T12:51:34.369092+00:00 heroku[router]: at=error code=H20 desc="App boot timeout" method=GET path=/ host=cmwidget.herokuapp.com fwd="77.101.66.230" dyno= connect= service= status=503 bytes=
    2013-08-26T12:52:19.445974+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
    

    It means that your Angular seed app is using it's own port (8000), and Heroku doesn't allow this. You need to relinquish the assignment of the port number to Heroku.

    Easily fixed. Modify scripts/web-server.js, and change this:

    this.server.listen(port);
    

    ...to this:

    this.server.listen(process.env.PORT || port);
    

提交回复
热议问题