Question: Heroku ruby app - run gulp build process after deploy

Question

Heroku ruby app - run gulp build process after deploy

Answers 1
Added at 2016-12-30 19:12
Tags
Question

I have a ruby application hosted on Heroku, it's a Ruby Sinatra app and I am using gulp to build my sass and coffee files for the client. I have added a postinstall script to my package.json and I have all my gulp dependencies listed but no npm install happens, probably because the app is a ruby application and npm is not on the deploy radar? Here's what my package.json looks like:

  "dependencies": {
    "gulp": "^3.9.1",
    "gulp-coffee": "^2.3.3",
    "gulp-filter": "^4.0.0",
    "gulp-plumber": "^1.1.0",
    "gulp-sass": "^3.0.0",
    "browser-sync": "2.16.0"
  },
  "devDependencies": {},
  "scripts": {
    "postinstall": "npm install && gulp build"
  }

What am I missing? Is it not possible to run npm and ruby on the same container?

Answers
nr: #1 dodano: 2016-12-30 20:12

I ended up finding the answer here: https://devcenter.heroku.com/articles/using-multiple-buildpacks-for-an-app

What I needed was to add a nodejs buildpack so that npm install would happen along with the postinstall script. Add a node buildpack using the Heroku CLI like this:

heroku buildpacks:add --index 1 heroku/nodejs

I also removed npm install from my postinstall hook because it happens automatically with the node buildpack.

Source Show
◀ Wstecz