Steve-Mcl / node-red-contrib-buffer-parser

A node-red node to convert values in a buffer, integer array or hex string into many different data type(s). Supports Big/Little Endian, BCD, byte swapping and much more.
MIT License
24 stars 8 forks source link

"TypeError: scale.matchAll is not a function" while using scale #9

Closed ouinouin closed 2 years ago

ouinouin commented 2 years ago

hi , first thanks for your palette, this is incredibly useful for people dealing with binary stuff. i got this error "TypeError: scale.matchAll is not a function" message while trying to use scale, it sometimes works but for the first shot of data only. i get this error with /100 /1000 , *0.01 etc but not with entering 0.01 for example. but while entering 0.01 , the division seems to be wrong when the number of digits of the integer is changing ( i have to investigate on this point, i m not 100% sure but this might give you a clue on the issue with the scale function.

PS : encounter also issue with conversion to string or ascii : they are not working at all returning empty results.

Steve-Mcl commented 2 years ago

Hi, can you confirm node version you are using?

I suspect you are using node V10 or less (which is end of life)

Do you have any means of updating node? I strongly recommend you do - v14 LTS is what if go with.

As for this string issue, can you provide a small flow what demonstrates your issue? Use an inject node to simulate the data & I will check it out.

ouinouin commented 2 years ago

hi, for the node version , i use the official nodered container with nodered 1.29 , i didnt find anywhere to find the node version in the UI , i ll check on another machine for tests since this one is running all the energy things of my home. I ll let you know,

Steve-Mcl commented 2 years ago

@ouinouin you need to enter node -v in a terminal.

My guess, based on the error and you node-red version, you are on nodejs 8 or 10 and really should upgrade.

ouinouin commented 2 years ago

yes you got it right . ill update while being less than 6200KM away from the house :-).

ouinouin@blacknuc:~$ sudo docker exec -it nodered node -v 
v10.23.2

indeed your node is really nice to use, you can prototype datasets of modbus or other tedious mappings, and do multple trials and errors for decoding quickly. I ll never be greatful enough for your well thought palette. (guessing you must ahave a foot in PLC world :-) )

Steve-Mcl commented 2 years ago

Yes I do. Mostly omron, mitsubishi and Siemens :)

Steve-Mcl commented 2 years ago

PS : encounter also issue with conversion to string or ascii : they are not working at all returning empty results.

I found this bug and is fixed in 863b5ff

As for the matchAll error, I have now handled this for node versions < 12 (reluctantly ;) )