Rails heroku - how to install javascript dependencies that need "npm install ..."

I am using rails app for heroku. I want to use some javascript libraries that want us to install npm dependencies as follows:

npm install abc 

So locally I can do how to install npm and do "npm install abc". Not sure how to do this in heroics along with my rail.

+4
source share
2 answers

Use the multiple build method from Heroku:

Using Multiple Buildpacks for an Application

Using NodeJS first and then Ruby, Heroku will install your node dependencies before anything happens in Ruby.

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

This will install the build package in heroku/ruby and then add heroku/nodejs , but at index 1 (which is the first). To confirm this, run:

 heroku buildpacks === ... Buildpack 1. heroku/nodejs 2. heroku/ruby 
+6
source

If you are deploying a Node application, declare it in your package.json, otherwise specify it in your gemfile.

https://devcenter.heroku.com/articles/getting-started-with-nodejs#declare-dependencies-with-npm

+1
source

Source: https://habr.com/ru/post/1501262/


All Articles