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 C:\Users\williams_b\.node-red\node_modules\npm\node_modules\graceful-fs\polyfills.js:287:18
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
Assuming that you were running with a lower version before the nodejs upgrade to 16, did you remember to go into your .node-red folder and run npm rebuild?
Many thousands (I guess) are running with v16 now so it is not a general problem.
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/
williams_b@ C:\Users\williams_b
`-- graceful-fs@4.2.10
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.
If you follow the rest of that message down, you'll find the very reference here , which I think needs to be linked to from the upgrade document.
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
Quite so. But a node-red ugrade does sometimes require a Node.js upgrade as in this case, so a link to these notes are critical.
But by the by, I still need to know where to run npm rebuild (since I have upgraded Node.js) and the document is ambiguous.
It says:
This can be done using the command npm rebuild - but it must be run in the right directory.
The "right directory" is singular
There are two places it should be run:
In your Node-RED user directory, ~/.node-red - this is where any additional nodes you have installed are.
In the directory you installed Node-RED
This is the ambiguous bit. "two places" is plural. It could mean both places or either-or.
Regardless of the true answer, I think that document needs rephrasing.
@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.