![](/img/trans.png)
[英]Whenever I try to run my server via Heroku I get "Error: Cannot find module 'dotenv'"
[英]Heroku Scheduler - When I try to run heroku run node, I get an error
我正在嘗試通過Heroku Scheduler插件創建一些cron作業。 我已經在本地計算機上測試了節點腳本,但是它運行正常,但是,當我提交並推送到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
作為參考,我正在遵循本指南 。
我在這里做錯了什么?
由於我的節點文件位於我的app/check_work_orders.js
文件中,因此我需要運行heroku run node app/check_work_orders.js
。 這解決了我的問題。 只需在Heroku服務器上的正確目錄中運行節點即可。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.