I have a Django app that I managed to deploy with Heroku. My Procfile
file only contains :
web: gunicorn omegapp3.wsgi --log-file -
So when I run heroku local
it works.
But when I deploy with heroku push master
, the console detects a Node app because the app has a package.json
and then the build fails.
What I would like to do is the following :
npm install
to install gulp
etc.Do you know how I can do that ?
According to the official documentation, you should add multiple buildpacks to your setup, rather than a single multi buildpack.
For example, if you wanted to deploy an app that uses a Nodejs package (i.e. grunt, gulp, etc) to do some setup on your app, you would run this from your command line:
heroku buildpacks:add --index 1 heroku/nodejs
The add
command adds the Nodejs buildpack as an additional buildpack, rather than replacing your current buildpack. Note the --index 1
. This specifies that the Nodejs buildpack is the first in the order of buildpacks. This is important because the final buildpack is the one used for actual process type. You can call heroku buildpacks
from the command line to verify the buildpack setup. I run a Python app, so my heroku buildpacks
looks like this:
=== your_app_name_here Buildpack URLs
1. heroku/nodejs
2. https://github.com/heroku/heroku-buildpack-python
Then, as stated by rocketer, you can place this in your package.json
file to be run on deploy:
"scripts": {
"postinstall": "./node_modules/.bin/gulp build"
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With