0
我在我的本地机器上安装了cron
模块,我在heroku上部署了我的应用程序。node.js`cron`模块不能在heroku上工作
new cronJob('00 00 * * * *', function() {
log.info('every hour');
}, null, true);
new cronJob('00 00 00 * * *', function() {
log.info('every day');
}, null, true);
第一个cronJob每小时执行一次log.info
函数,第二个 - 每一天执行一次。脚本在我的本地机器上完美运行,但不适用于heroku。
您是否将其添加到您的package.json文件中https://devcenter.heroku.com/articles/getting-started-with-nodejs#declare-dependencies-with-npm – KeepCalmAndCarryOn
@KeepCalmAndCarryOn当然可以。除此之外的所有模块都能完美工 – user3215609