简体   繁体   English

如何在已部署的 Heroku NodeJS 应用程序上运行 npm 脚本

[英]How to run a npm script on a deployed Heroku NodeJS app

Under scripts in package.json I have the following.package.json中的scripts下,我有以下内容。

'refresh': node refresh db

Is there a way to trigger this particular npm script on a NodeJS app deployed on Heroku.有没有办法在部署在 Heroku 上的 NodeJS 应用程序上触发这个特定的 npm 脚本。

是:

$ heroku run npm run refresh

Per the Heroku Node.js Documentation , you can add pre and post install scripts. 根据Heroku Node.js文档 ,您可以添加安装前和安装后脚本。 In addition, you can add scripts that can be triggered by environment variables. 此外,您还可以添加可由环境变量触发的脚本。

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只需在 heroku 仪表板 ( https://dashboard.heroku.com/apps/[app_name] ) 中登录即可管理您的应用程序,然后单击右侧的更多 > 运行控制台

Then you can run any command: command line in heroku然后你可以运行任何命令: heroku中的命令行

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM