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.
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
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