LoginSignup
3
2

More than 5 years have passed since last update.

Herokuでbower installする

Last updated at Posted at 2015-08-31

Herokuはbuildpackがあるので、簡単にnode.jsやnpmを動かすことができますね。いいですね。

Herokuでアプリケーションを新規作成

すでに、ローカルで動くことを前提としています。

$ cd ~/project_dir
$ heroku create

buildpackのURLを指定

$ heroku config:set BUILDPACK_URL=https://github.com/heroku/heroku-buildpack-multi.git

node.js/bowerの設定

バージョンは、念のため開発環境に合わせておきます(Herokuで対応していないバージョンの場合、勝手に近しいものに置き換わるっぽいです)。

/package.json
{
  "engines": {
    "node": "0.12.7",
    "npm": "2.12.1"
  },
  "dependencies": {
    "bower": "1.4.1"
  },
  "scripts": {
    "postinstall": "bower install"
  }
}
/.buildpacks
https://github.com/heroku/heroku-buildpack-nodejs
https://github.com/heroku/heroku-buildpack-ruby
source "https://rubygems.org"

ruby '2.2.3'

gem "sinatra", require: "sinatra/base"
gem "sinatra-contrib", require: "sinatra/reloader"
gem "sinatra-assetpack"
gem "sass"

gem "slim"
$ git push heroku master

これで、node.js / npmのバイナリが設置され、postinstallで指定したbower installが動くようになります。おめでとうございます。自分。

3
2
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
3
2