简体   繁体   English

Heroku Scheduler-当我尝试运行heroku运行节点时,出现错误

[英]Heroku Scheduler - When I try to run heroku run node, I get an error

I'm trying to create some cron jobs via the Heroku scheduler plugin. 我正在尝试通过Heroku Scheduler插件创建一些cron作业。 I've tested my node script on my local machine and it works fine, however, when I commit and push to heroku, when I run heroku run node check_work_orders.js , I get this error: 我已经在本地计算机上测试了节点脚本,但是它运行正常,但是,当我提交并推送到heroku时,当我运行heroku run node check_work_orders.js ,出现此错误:

Running node check_work_orders.js on ⬢ fms-sandbox... up, run.4992 (Free)
module.js:471
    throw err;
    ^

Error: Cannot find module '/app/check_work_orders.js'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.runMain (module.js:604:10)
    at run (bootstrap_node.js:393:7)
    at startup (bootstrap_node.js:150:9)
    at bootstrap_node.js:508:3

For reference, I was following this guide . 作为参考,我正在遵循本指南

What am I doing wrong here? 我在这里做错了什么?

Since my node file was location in my app/check_work_orders.js file, I needed to run heroku run node app/check_work_orders.js . 由于我的节点文件位于我的app/check_work_orders.js文件中,因此我需要运行heroku run node app/check_work_orders.js This solved my problem. 这解决了我的问题。 It was just a matter of running node in the correct directory on the Heroku server. 只需在Heroku服务器上的正确目录中运行节点即可。

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

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