Use of dotenv in a cron job with ES6 modules
NateWr opened this issue · 2 comments
NateWr commented
I am struggling to find an example of using this package in a Node script that is run by a cron job. All of the examples I have found rely on __dirname
(see here), which is not available when running a script as a module with the import syntax.
Running from cron seems like a core use case for Node scripts. Can anyone provide a working example of how to configure this so that Node scripts work regardless of the calling context? Or is this a problem that should be solved upstream somehow?
NateWr commented
It looks like the problem I'm facing is due to cron running under the root
user, using an outdated version of node
. Apologies for the noise.
motdotla commented