This sample application for Heroku shows how Heroku's support for multiple buildpacks can be used to run both the Node.js and PHP buildpacks during a deploy, which allows using Node from inside the PHP buildpack's
To try it out, clone this repo, run
heroku create, then
heroku buildpacks:add heroku/nodejs followed by
heroku buildpacks:add heroku/php, and finally deploy using
git push heroku master. If you want to port this to an existing app, you'll need to use a combination of
heroku buildpacks:set and
heroku buildpacks:add to set the correct buildpack order.
You can also quickly deploy a version of this example to Heroku by clicking the button below:
heroku buildpacks:addcommand is used to set multiple buildpacks on an app (see
$(npm bin -q)/bower install-
bower installwould work too, as
$PATHon Heroku, but it would likely not work on local development environments, hence the more portable use of prefixing the result from
npm bin -qto retrieve said directory name.