aksanoble
aksanoble

Reputation: 2570

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.

Upvotes: 12

Views: 14161

Answers (3)

Shlomo
Shlomo

Reputation: 337

You can also do this using only the browser; Just log in to manage your app in the heroku dashboard (https://dashboard.heroku.com/apps/[app_name]) and there click on the right side of it: More > Run console

Then you can run any command: command line in heroku

https://devcenter.heroku.com/changelog-items/1137

Upvotes: 0

hunterloftis
hunterloftis

Reputation: 13799

Yes:

$ heroku run npm run refresh

Upvotes: 29

Ruby_Pry
Ruby_Pry

Reputation: 237

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.

Upvotes: 1

Related Questions