Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rails heroku - how to install javascript dependences that needs 'npm install ...'

I am deploying my rails app to heroku. I want to use some javascript libraries which want us to install npm dependencies like this:

npm install abc

So, locally I can do like installing npm and doing 'npm install abc'. Not sure how to do it in heroku along with my rails app.

like image 460
user2139745 Avatar asked Sep 09 '13 09:09

user2139745


1 Answers

Use the multiple builds approach from Heroku:

Using Multiple Buildpacks for an App

By having the NodeJS one first and then the Ruby one, Heroku will install your node dependencies before anything happens in Ruby.

heroku buildpacks:set heroku/ruby
heroku buildpacks:add --index 1 heroku/nodejs

That will set the build pack to heroku/ruby and then add the heroku/nodejs one but in index 1 (which is first). To confirm this, run:

heroku buildpacks
=== ... Buildpack
1. heroku/nodejs
2. heroku/ruby
like image 187
Cymen Avatar answered Oct 22 '22 06:10

Cymen