将ember-cli应用程序部署到Heroku

时间:2014-04-04 21:22:48

标签: node.js heroku ember.js ember-cli

如何将我的Procfile中的ember-cli生成的应用程序部署到Heroku?

=== web (1X): `ember server`
web.1: crashed 2014/04/10 13:19:57 (~ 48s ago)  

=== web (1X): `npm start`
web.1: crashed 2014/04/10 13:22:11 (~ 2m ago)

5 个答案:

答案 0 :(得分:5)

您可以使用Heroku Ember CLI buildpack:https://github.com/heroku/heroku-buildpack-emberjs

答案 1 :(得分:4)

我在我的Procfile中有这个,它对我有用:

web: ember serve --environment production --port $PORT

我按照this gist的说明操作,这是我获得Procfile的地方。

gist中的ember-cli版本和依赖项已过时,这导致我的应用程序崩溃与您的类似。

我需要添加/替换"依赖项"中列出的软件包。我的package.json文件中包含ember-cli包的部分放入" devDependencies"包json的部分。当我完成后,我的package.json文件看起来像这样:

{
  "name": "your-apps-name",
  "version": "0.0.0",
  "private": true,
  "directories": {
    "doc": "doc",
    "test": "test"
  },
  "scripts": {
    "start": "ember server",
    "build": "ember build",
    "test": "ember test",
    "postinstall": "bower install"
  },
  "repository": "https://github.com/stefanpenner/ember-cli",
  "engines": {
    "node": ">= 0.10.0"
  },
  "author": "Your Name",
  "license": "Your App's License",
  "devDependencies": {
    "ember-cli": "0.0.28",
    "originate": "0.1.5",
    "broccoli-ember-hbs-template-compiler": "^1.5.0",
    "loom-generators-ember-appkit": "^1.1.1",
    "express": "^4.1.1",
    "body-parser": "^1.2.0",
    "glob": "^3.2.9"
  },
  "dependencies": {
    "bower": "^1.3.3",
    "broccoli-template": "0.1.1",
    "ember-cli": "0.0.28",
    "originate": "0.1.5",
    "broccoli-ember-hbs-template-compiler": "^1.5.0",
    "loom-generators-ember-appkit": "^1.1.1",
    "express": "^4.1.1",
    "body-parser": "^1.2.0",
    "glob": "^3.2.9"
  }
}

答案 2 :(得分:2)

Procfile:

web: npm run start

的package.json:

"scripts": {
  "start": "ember serve --port=${PORT}",
  "build": "ember build",
  "test": "ember test",
  "postinstall": "bower install"
},

并重命名devDependencies块并添加bower作为依赖项:

"devDependencies": { ... }

to 

"dependencies": { 
  "bower": "1.3.12"
  ...
}

但是再次添加devDependencies并在那里添加ember-cli以供ember检测你的app:

"devDependencies": {
  "ember-cli": "0.1.15"
}

可以在我的博客中找到更多信息和更多链接:

https://personalwebdevelopment.wordpress.com/2015/02/23/deploying-ember-cli-app-to-heroku/

答案 3 :(得分:0)

你可以试试  npm start'或者' ember服务器'

答案 4 :(得分:0)

您可以使用Heroku推荐的Ember buildpack:https://www.heroku.com/emberjs

要为现有应用程序定义此buildpack,您需要运行以下命令:

heroku buildpacks:set https://codon-buildpacks.s3.amazonaws.com/buildpacks/heroku/emberjs.tgz