Problem with install & run older NodeRed version v2.2

The last stable version of NodeJS for Win7 32bit is v12.

According to this table NR v2.2 should be compatible with NodeJS v12.

So I've nstalled NR v2.2.3 version with this command:
npm install -g --unsafe-perm node-red@2.2.3

But if I try to start, following error is shown:

C:\Windows\system32>npm i -g --unsafe-perm node-red@2.2.3
npm WARN deprecated multer@1.4.4: Multer 1.x is affected by CVE-2022-24434. This is fixed in v1.4.4-lts.1 which drops su
pport for versions of Node.js before 6. Please upgrade to at least Node.js 6 and version 1.4.4-lts.1 of Multer. If you n
eed support for older versions of Node.js, we are open to accepting patches that would fix the CVE on the main 1.x relea
se line, whilst maintaining compatibility with Node.js 0.10.
npm WARN deprecated axios@0.27.0: Formdata complete broken, incorrect build size
C:\Users\IT\AppData\Roaming\npm\node-red -> C:\Users\IT\AppData\Roaming\npm\node_modules\node-red\red.js
C:\Users\IT\AppData\Roaming\npm\node-red-pi -> C:\Users\IT\AppData\Roaming\npm\node_modules\node-red\bin\node-red-pi
+ node-red@2.2.3
updated 7 packages in 34.878s

C:\Program Files\nodejs\node_modules\node-red\node_modules\@node-red\runtime\lib\flows\Flow.js:164
                    const globalCreds = credentials.get( || {}

SyntaxError: Unexpected token '.'
    at wrapSafe (internal/modules/cjs/loader.js:915:16)
    at Module._compile (internal/modules/cjs/loader.js:963:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (C:\Program Files\nodejs\node_modules\node-red\node_modules\@node-red\runtime\lib\flows\index.
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)

(The install shows "update", because first I've tried with v2.2.2 but realized later there is a newer version 2.2.3)

There seems to be node 18 available as 32 bit windows main though I have no idea if it works. Index of /dist/latest-v18.x/

I am using node red 2.2.2 on an ancient pi with nodejs 10, so you should be ok. The syntax it is complaining about is not valid for old nodejs. I wonder whether you are running the version you think.

What do you see if you run
node-red --help
from the same folder (system32)

Sadly that is only true for Win8.1+
That info is missing on their webpage and you realize that only after you have tried to install.

So NO, Win7 32bit can officially run max NodeJS v12.

The exact same error.

I am not familiar with the directory structure on Windows, but if there is a file C:\Program Files\nodejs\node_modules\node-red\ see what is at the start of that file to see what version it is.
I have now installed 2.2.3 and the line it is complaining about does not occur in that file.

You are right!
The first line is:

3.1.3: Maintenance Release

So the question is:

  • Why does not NR checks the minimal version of NodeJS at the beginning
  • How do I install the old version instead of latest?

I don't know

You did install the old version, you can see that from the output of the command. I suspect you now have two versions installed. I don't know about windows so can't say how that came about or what do do about it. You will need someone who knows about Windows to help you.

Solution I've found:

  1. uninstalled NR:
    npm uninstall node-red
  2. reinstalled with:
    npm i -g --unsafe-perm --force node-red@2.2.3

The trick was the: --force switch.
Simply uninstall + reinstall was not enough no matter what I've tried.
Now it's running. :slight_smile:

Still, it would help a lot, if while starting NR with lower JS version installed would drop a big fat message like:

ERROR: Current v3.1.x version can only start on NodeJS version 16+ (recommended v18+) . Exiting.

... or something like that.

That would be down to npm warning you - not Node-RED as it is npm that is doing the installation at that point. There was some effort a while back to make a Windows based Node-RED installer that did do a load of checks and warnings - but I'm not sure of the state of that as I don't use Windows.

I think You have misunderstood something...
I am talking about an error necessary while starting node-red.

There is already a built-in system preventing installing it on a low-version nodeJS.

But if there are some leftover files from a newer installation that failed, those are not getting overwritten by the a lower version without the --force switch.

Uninstall does not seem to clean up everything properly.

... apparently not...

again an npm problem...

... but yes I guess we could exit earlier after a quick check rather than crash later. But if what you say is correct about not cleaning up then I guess the main check could pass but then hit an unclean file later ?

I think that means that the npm cache was messed up.

That could be it!
Because I've checked that directory and it did not even exist when it complained about it.

npm ERR! path C:\Program Files\nodejs\node_modules\node-red\red.js
npm ERR! dest C:\Program Files\nodejs\node-red
npm ERR! EEXIST: file already exists, cmd shim 'C:\Program Files\nodejs\node_modules\node-red\red.js' -> 'C:\Program Files\nodejs\node-red'
npm ERR! File exists: C:\Program Files\nodejs\node-red
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.

But I did not clean any cash dir.
I really hate those installers which leave bunch of temp files on my disk :-1:
I've just searched for it, and realized:

  • there is a way to clean the cache of npm manually

npm cache clean

... npm will not remove data by itself: the cache will grow as new packages are installed.

... tried it:

C:\Windows\system32>npm cache clean
npm ERR! As of npm@5, the npm cache self-heals from corruption issues and data extracted from the cache is guaranteed to
 be valid. If you want to make sure everything is consistent, use 'npm cache verify' instead. On the other hand, if you'
re debugging an issue with the installer, you can use `npm install --cache /tmp/empty-cache` to use a temporary cache in
stead of nuking the actual one.
npm ERR!
npm ERR! If you're sure you want to delete the entire cache, rerun this command with --force.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\IT\AppData\Roaming\npm-cache\_logs\2023-12-17T23_01_56_022Z-debug.log

C:\Windows\system32>npm cache verify
Cache verified and compressed (~\AppData\Roaming\npm-cache\_cacache):
Content verified: 741 (59192768 bytes)
Content garbage-collected: 1 (40828 bytes)
Index entries: 1171
Finished in 2.526s

I believe there are separate caches for local and global installs, so I think that to clear everything out you need to run (from the .node-red folder, that is important)
npm cache clear --force
and then from anywhere
sudo npm cache clear -g --force
The sudo may not be necessary on Windows, I don't know.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.