如何部署Angular.js应用程序?

问题描述:

这可能是一个愚蠢的问题,但我想知道我应该使用什么平台部署我的Angular.js应用程序?我尝试使用Heroku,但有一个没有Cedar支持的应用程序检测到错误。任何想法?

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" error. Any thoughts?

更新

我正在尝试将其作为Node.js应用程序提供给heorku,但仍然似乎无法使其工作。在我的应用程序的根目录中有一个web-server.js文件,我在我的Procfile中引用它:

I'm trying to serve this to heorku as a Node.js application, but still can't seem to get it working. There's a web-server.js file in the root directory of my application and I reference it in my Procfile here:

web: node web-server.js

这里是我的package.json文件,也在根目录下: / p>

And here's my package.json file, also in the root directory:

{
"name": "medicare-data",
"version": "0.0.1",
"dependencies": {
},
"engines": {
    "node": "0.10.x",
    "npm": "1.2.x"
},
"respository": "medicare-data",
"author": "sararob"
}

我在我的heroku日志中收到了一个slug编译错误。对于为什么这可能不起作用的想法?

I'm getting a "slug compilation error" in my heroku logs. Thoughts on why this might not be working?

如果将其用作节点,则可以在heroku上运行Angular应用程序。 js应用程序。通常,当您开始使用角度种子时,项目中已经有一个节点Web服务器脚本。我相信如果根目录中有一个package.json文件,那么heroku将会检测并运行它作为一个node.js应用程序。我会回来更新这个答案,更多的细节很快。

You can run an Angular app on heroku if it is served as a node.js application. Usually, when you start working with Angular seed, there is already a node webserver script in the project. I believe if there is a package.json file in the root, heroku will detect and run it as a node.js application. I'll come back and update this answer with more detail shortly.

更新

从Heroku文档我不是专家),它在部署部分之后有这段经文: https:/ /devcenter.heroku.com/articles/nodejs#visit-your-application

From the Heroku docs (and I am no expert), it has this passage after the deploy section: https://devcenter.heroku.com/articles/nodejs#visit-your-application

这基本上告诉你确保你有一个运行。您可以通过应用程序设置下的网络应用程序来执行此操作,也可以执行以下操作:

which basically tells you to make sure you have one dyno running. You can do that either through the web app under the settings of your app or you can run this:

$ heroku ps:scale web=1

要查看进程是否正在运行,请执行

To see if the process is running, do

$ heroku ps
=== web: `node web.js`
web.1: up for 10s