In the upgrade notes for v3.0 it says: " Node.js 14.x or later required" ;
foolishly assuming that meant that the latest version of Node.js had been tested, I blithely installed the latest version, 16.16.0 LTS (Recommended For Most Users).
When I restarted node-red, I got the following error:
18 Jul 18:11:10 - [info] Node-RED version: v3.0.0
18 Jul 18:11:10 - [info] Node.js version: v16.16.0
18 Jul 18:11:10 - [info] Windows_NT 10.0.18363 x64 LE
18 Jul 18:11:20 - [red] Uncaught Exception:
18 Jul 18:11:20 - [error] TypeError: cb.apply is not a function
at FSReqCallback.oncomplete (node:fs:199:5)
Googling the error, I found it was mostly related to Node.js upgrades, so I uninstalled it (thankfully easy on windows) and downloaded the 14.0 (the lowest number required).
So, recommendation to @knolleary , unless this is an idiosyncratic problem for me, it might be best to edit your upgrade notes with a warning not to upgrade Node.js greater than the latest version you know that it runs on.
Lastly, what I find astonishing is that if you google
Answer: I would have done if it was in the documentation that I was pointed to. It might be more obvious to developers than home users.
That's not meant to be a criticism, just that some of we whitebeards stopped programming for a living when Fortran77 was still in use! Hence the appeal of node-red.
So, if npm rebuild is needed, and Node-red is the low code environment it is meant to be, I think it really ought to be included in the upgrade information here that is referenced in the release announcement.
Having just googled node red how to upgrade "node.js" , I found this which is clearly the very thing I needed to read!
I strongly recommend that a link to it is included in the "upgrading" section of your "installing node red" that is referenced in the release announcement. It might have saved me having to downgrade.
Do you think there would be any value in doing the npm rebuild now?
C:\Users\williams_b>npm list graceful-fs
npm does not support Node.js v14.0.0
You should probably upgrade to a newer version of node as we
can't make any promises that npm will work with this version.
You can find the latest version at https://nodejs.org/
No, you need to upgrade NODE back to 16 and fix the below
This is the problem ↑ Its too old.
Once you are back on NODE 16, run that command again. It will tell you which node is importing this old version of graceful-fs - then you can either request the contrib node be updated OR try fixing it yourself (we can help with that)
I've gained more wisdom here today than ever before!
I was just looking at that contrib on Github and saw a warning from (I guess) a node-red developer called Sam Machin warning that it would break in Node-red 2.0 (I was running 1.3.5) . Looks like the developer stopped before then because it was the last issue left unanswered.
Presumably this is because of the new feature I have yet to take advantage of!
Could you point me at where it is documented? Sorry to be so helpless!
Also, should I run npm rebuild in both those directories I mentioned earlier?
That is talking about upgrading node-red, npm rebuild is not necessary after upgrading node-red, but it may be required after upgrading (or downgrading) nodejs. I am not sure whether there is a section in the docs on upgrading nodejs, but if not then I agree that it would be a useful addition.
As stated earlier, npm rebuild should be run from the .node-red directory. It will not fix problems caused by modules that do not work with later versions of nodejs, it is purely to rebuild any modules that include native code, as they need to be rebuilt to be compatible with the new nodejs version.
@knolleary could you comment on this please? The docs for upgrading nodejs (Supported Node versions : Node-RED) says that npm rebuild should be also be run in the node-red install directory. Is that still the case? I have never done that as far as I can remember.