Node-red-contrib-cron-plus timezone error

I am running node-red 0.20.7, nodejs 8.11.2 in Termux on Android. When using node-red-contrib-cron-plus 0.3.0 with the timezone setting empty it shows a status of
Error: check timezone setting
Though it does appear to be using the correct timezone (GB).

If I set the timezone to GB in the node then the field in the node config shows
Europe/London
but when I Deploy it shows a red status Error creating Job and in the debug window it says "Error: Invalid IANA name or offset"

Hi @Colin could you post a small flow demonstrating this please?

I'll take a look.

It doesn't need a flow, just the node
image

[{"id":"47f10950.f6e028","type":"cronplus","z":"fcec201.12ad9e","name":"Schedule","outputField":"payload","timeZone":"","options":[{"topic":"06:00","payload":"20.0","type":"str","expression":"00 00 06 * * * *"}],"x":200,"y":320,"wires":[["ca87681c.281dc","2b0d25c4.9e7dea"]]}]

and if set the timezone to GB I see
image

[{"id":"47f10950.f6e028","type":"cronplus","z":"fcec201.12ad9e","name":"Schedule","outputField":"payload","timeZone":"Europe/London","options":[{"topic":"06:00","payload":"20.0","type":"str","expression":"00 00 06 * * * *"}],"x":200,"y":320,"wires":[["ca87681c.281dc","2b0d25c4.9e7dea"]]}]

Running on Ubuntu it is ok (though that is with node 10.x)
It is not an urgent problem as with the empty timezone it is working ok except for the status message.

Hmmm, I dont get that on mine...
image

Guess I'll have to setup an ubuntu with node V8 + NR 20.7

Could you do a test for me?

Install the below and restart? ...

cd ~node-red
npm install full-icu

It may be the minimal intl support in default nodejs install

EDIT:
this suggests Intl.DateTimeFormat is node v9+

hmmm. How to fix :thinking:

Just re-read that. Looking very likely its a node v8 thing.

Wonder if its possible to check NPM version inside a custom node & handle things accordingly?

Does that mean you don't need me to install full-icu?

Easy to restrict install to just specific versions of nodejs in your package.json

I see that node 10.x is now available in the termux repo, do you want me to try that? Not sure whether I would be able to get back to 8.x though.

if you could, yes please.

@ukmoose Thanks.

Would setting this prevent a user from installing in the NR pallete?

Could you show me how/where please?

https://docs.npmjs.com/files/package.json#engines

1 Like

Damn, I have broken my termux install trying to upgrade stuff. Apparently you can't do that with Termux.

npm won't run

$ npm -v
CANNOT LINK EXECUTABLE: library "libcrypto.so.1.1" not found
page record for 0xb607c02c was not found (block_size=16)

Oh dear.

Is that termux on Android?

I'm certain I got node V10 working in it on my old device (can't check right now)

Yes it wanted to upgrade to 12.x but 10.x is available as nodejs-lts so I removed nodejs and installed nodejs-lts and now npm won't run. Also if I try to do a full package update then I get

E: This installation run will require temporarily removing the essential package libandroid-support:arm due to a Conflicts/Pre-Depends loop. This is often bad, but if you really want to do it, activate the APT::Force-LoopBreak option.
E: Internal Error, Could not early remove libandroid-support:arm (2)

which google suggests mean I need to remove the app and re-install which presumably means I will need to re-install mosquitto, node red and so on.

Perhaps just apt install npm will be enough?

Note, as it's a node upgrade, I believe you should reinstall node_modules anyhow (some things get compiled for specific version I believe).

Sorry to cause you grief. Appreciate you testing the node ver theory.

There doesn't appear to be an npm package, I presume it comes with nodejs.

Raised an issue here

Having got my system up and running again, well more or less, I can confirm it works as it should with node.js 10.16.3 running in Termux on Android 6

A little late to the conversation but as I think you've already discovered, node.js v8 at least only includes a small subset of the files.

However, there is an explanation of how to patch this here:

https://nodejs.org/docs/latest-v8.x/api/intl.html#intl_providing_icu_data_at_runtime

And this somewhat dated article shows you how to polyfill though I'm not sure that's needed now anyway even with v8

https://formatjs.io/guides/runtime-environments/

1 Like