I created a project with some flows on my Windows VM installation of Node Red. There is one function node with a line like
msg.payload = msg.payload.replace("&", "&");
On my Windows VM it works fine. On my Raspberry Pi I get an error message saying "TypeError: replace() is not a function.". My Google search only gave the result to add "tostring()" before "replace()" but then I get "tostring() is not a function". Any ideas?
replace is a function of a string var, is msg.payload a string, add debug nodes and check what msg.payload is going into function tostring() should be toString() with a capital S.
I am confused. I just restarted my Pi and now it works directly with replace()...
Don't know why, but thank you for the hint. (Debug shows original payload is already a string)