0

I updated nodejs from 8 to 10.12 and receive that warning message.

D:\BitBucket\EA Studio>node index
DEPRECIATION: imediateStart is deprecated and will be removed soon in favor of the options param.
...

package.json

{
  "dependencies": {
    ...
    "node-cron": "^2.0.3",
}

Usage:

"use strict";

const cron = require("node-cron");
cron.schedule("5 * * * *", () => null, false);

Any solutions?

Since I don't use imediateStart in my code, the warning origin must be within the internal code of the node-cron. Do the developers made that to not forget to update their own code? how much better would be to show: "This version of node-cron uses deprecated code. Please update it to version xxx as soon as it is released".

Miroslav Popov
  • 3,294
  • 4
  • 32
  • 55

2 Answers2

2

Just replace

cron.schedule("5 * * * *", () => null, false);

with

cron.schedule("5 * * * *", () => null, {scheduled:false});

From node-cron documentation on schedule method:

options Object: Optional configuration for job scheduling.

Options

scheduled: A boolean to set if the created task is schaduled. Default true;

timezone: The timezone that is used for job scheduling;

Vasyl Moskalov
  • 4,242
  • 3
  • 20
  • 28
1

Run the script with --trace-warnings flag. eg.: node --trace-warnings index.js. It will give you a detailed info what causes the warning.

lependu
  • 1,160
  • 8
  • 18