xo-cli as cron-job: Error [ERR_MODULE_NOT_FOUND]: Cannot find package
-
Hi!
I want to run some xo-cli commands as a cronjob on XOA.
The script runs fine on CLI, but in a cronjob, I am getting:Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'fs' imported from /usr/local/lib/node_modules/xo-cli/index.mjs at packageResolve (internal/modules/esm/resolve.js:664:9) at moduleResolve (internal/modules/esm/resolve.js:705:18) at Loader.defaultResolve [as _resolve] (internal/modules/esm/resolve.js:798:11) at Loader.resolve (internal/modules/esm/loader.js:100:40) at Loader.getModuleJob (internal/modules/esm/loader.js:246:28) at ModuleWrap.<anonymous> (internal/modules/esm/module_job.js:47:40) at link (internal/modules/esm/module_job.js:46:36) { code: 'ERR_MODULE_NOT_FOUND' }Can you give me a hint, why that path is not found?
Thank you and best wishes
KPS -
I found the issue. I had to add the PATH-variable in the script:
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin -
Haha yeah, it's an usual mistake I'm often doing myself

Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login