Skip to content

Instantly share code, notes, and snippets.

@verytired
Last active December 16, 2016 09:25
Show Gist options
  • Save verytired/18cca3619fd12b90538ffc4cea0dfd9b to your computer and use it in GitHub Desktop.
Save verytired/18cca3619fd12b90538ffc4cea0dfd9b to your computer and use it in GitHub Desktop.
herokuでnodejsのbuildを有効にする

command

heroku login
heroku buildpacks:clear --app APP //初期化
heroku buildpacks:heroku/nodejs //deploy時にnpm installが実行される
heroku config:set NPM_CONFIG_PRODUCTION=false --app APP //package.jsonのdevDependenciesに追加したnodeモジュールがインストールされないため環境変数を追加

package.json

heroku-prebuildで npm install後に実行。 heroku-postbuildで heroku-prebuild後に実行。

}
"scripts": {
  "heroku-prebuild": "echo This runs before Heroku installs your dependencies.",
  "heroku-postbuild": "echo This runs afterwards."
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment