Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run a npm script on a deployed Heroku NodeJS app

Under scripts in package.json I have the following.

'refresh': node refresh db

Is there a way to trigger this particular npm script on a NodeJS app deployed on Heroku.

like image 846
aksanoble Avatar asked Jul 25 '16 15:07

aksanoble


2 Answers

Yes:

$ heroku run npm run refresh
like image 168
hunterloftis Avatar answered Oct 15 '22 17:10

hunterloftis


Per the Heroku Node.js Documentation, you can add pre and post install scripts. In addition, you can add scripts that can be triggered by environment variables.

like image 44
Ruby_Pry Avatar answered Oct 15 '22 19:10

Ruby_Pry