LoginSignup
4
4

More than 5 years have passed since last update.

CompassとNodeJSをHerokuに環境構築した

Last updated at Posted at 2015-06-27

初めてのNodeJSをHerokuへデプロイしてはまりました。
express4とsass(node-compass)をHeroku上にデプロイしたら、CSSの出力箇所でプロセスごと落ちてしまいApplication Errorが表示されるという事態になりました。
そういえばRubyのCompassが必要だったのを思い出し、どうやってCompassインストールするんだろうとググっていたら
以下のURLで解決しました。
https://stackoverflow.com/questions/28953002/heroku-express-app-error-spawn-compass-enoent/29046807#29046807
備忘録。

手順

コンソールで以下のコマンドを打ちます。

Console
heroku config:add BUILDPACK_URL=https://github.com/ddollar/heroku-buildpack-multi.git

プロジェクトフォルダ直下に以下の2つのファイルを作成しgit add。

.buildpacks
https://github.com/heroku/heroku-buildpack-nodejs.git
https://github.com/heroku/heroku-buildpack-ruby.git
Gemfile
source "https://rubygems.org"
gem "compass"

プロジェクトフォルダ直下で以下のコマンドを打ちます。(bundleコマンドはRubyのbundlerというパッケージに含まれている)

Console
bundle install

すると直下にGemfile.lockという名前のファイルができるのでgit addします。

Git Push

Console
git push heroku master

以上でうまく動きました。

その他

デプロイを何度か失敗したら以下のようなエラーが発生しましたが、コンソールで解決しました。
heroku[router]: at=error code=H14 desc="No web processes running" method=GET path=...

Console
heroku ps:scale web=1
4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4