Answer the question
In order to leave comments, you need to log in
How to fix error when running script with cron?
console.log(process.argv);
ts-node /root/autoinst/instAPI/bot/upload.ts
ts-node /root/autoinst/instAPI/bot/upload.ts
[
'/root/.nvm/versions/node/v12.14.1/bin/ts-node',
'/root/autoinst/instAPI/bot/upload.ts'
]
ts-node --dir /root/autoinst/instAPI/bot/ /root/autoinst/instAPI/bot/upload.ts
ts-node -s /root/autoinst/instAPI/bot/upload.ts
результат будет такой же). Список опций ts-node приложен ниже.*/5 7-21 * * * /root/.nvm/versions/node/v12.14.1/bin/ts-node --dir /root/autoinst/instAPI/bot/ /root/autoinst/instAPI/bot/upload.ts >> log.log
Subject: Cron <[email protected]> /root/.nvm/versions/node/v12.14.1/bin/ts-node --dir /root/autoinst/instAPI/bot/ /root/autoinst/instAPI/bot/upload.ts >> /root/autoinst/tgBot/logs/cronTurn.log
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/root>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=root>
Message-Id: <[email protected]>
Date: Thu, 16 Apr 2020 13:50:03 +0300 (MSK)
(node:32420) ExperimentalWarning: The ESM module loader is experimental.
TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" for /root/autoinst/instAPI/bot/upload.ts
at Loader.defaultGetFormat [as _getFormat] (internal/modules/esm/get_format.js:65:15)
at Loader.getFormat (internal/modules/esm/loader.js:110:42)
at Loader.getModuleJob (internal/modules/esm/loader.js:241:31)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at Loader.import (internal/modules/esm/loader.js:175:17)
Answer the question
In order to leave comments, you need to log in
Try adding
*/5 7-21 * * * cd autoinst/instAPI; /root/.nvm/versions/node/...........
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question