Upgrade node-red on windows

Hi all!
I'm trying to upgrade node-red on my windows 10 from 2.2.1 to the newer.
So, I used the command

npm install -g --unsafe-perm node-red

as read in the guide.

After a few seconds, it returns

changed 293 packages in 14s

41 packages are looking for funding
   run npm fund for details

so I use

node-red

command again but it is still at 2.2.1 version.

I tried to upgrade NodeJs downloading from the website and now I have 20.3.0 version, but it seems that node-red doesn't want to upgrade anyway.

What I'm wrong?

Thank you all!

Hi, did you run your command

npm install -g --unsafe-perm node-red

with version 20 of NodeJS or the previous version?

Hi @GogoVega
With both but nothing changed

Do you read the version of Node-RED from the terminal or from the editor (browser) because you have to refresh the editor. Do you get an error when launching NR?
Do you have v20.3.0 when you run the command node -v?

I read the number 2.2.1 from terminal and in browser too.
Yes, if I run the command you said it returns

v20.3.0

I attach what I see when run node-red command

PS C:\Users\Nu!Reha> node-red
12 Jun 14:41:03 - [info]

Welcome to Node-RED
===================

12 Jun 14:41:03 - [info] Node-RED version: v2.2.1
12 Jun 14:41:03 - [info] Node.js  version: v20.3.0
12 Jun 14:41:03 - [info] Windows_NT 10.0.19045 x64 LE
12 Jun 14:41:04 - [info] Loading palette nodes
12 Jun 14:41:05 - [warn] [node-red-contrib-tuya-smart-device] Node module cannot be loaded on this version. Requires: >=2.5.0
12 Jun 14:41:06 - [info] Dashboard version 3.5.0 started at /ui
12 Jun 14:41:06 - [info] Settings file  : C:\Users\Nu!Reha\.node-red\settings.js
12 Jun 14:41:06 - [info] Context store  : 'default' [module=memory]
12 Jun 14:41:06 - [info] User directory : /home/nol/.node-red/
12 Jun 14:41:06 - [warn] Projects disabled : editorTheme.projects.enabled=false
12 Jun 14:41:06 - [info] Flows file     : \home\nol\.node-red\flows.json
12 Jun 14:41:06 - [info] Server now running at http://127.0.0.1:1880/
12 Jun 14:41:06 - [warn]

---------------------------------------------------------------------
Your flow credentials file is encrypted using a system-generated key.

If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.

You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.
---------------------------------------------------------------------

12 Jun 14:41:06 - [info] Starting flows
12 Jun 14:41:06 - [info] Started flows
12 Jun 14:41:06 - [info] [alexa-remote-account:e66d9d76ee78d58e] intialising with the PROXY method and saved data...

And this is in the editor:

Can you run

npm list -g

If the Node-RED version is 3, can you try restarting your computer

Running the command it returns:

PS C:\Users\Nu!Reha> npm list -g
C:\ProgramData\npmglobal
+-- @tuyapi/cli@1.18.3
+-- node-gyp@8.4.1
+-- node-red@3.0.2
`-- npm@9.7.1

I tried to restart my computer but nothing changed.
When I run

node-red

command it says that I'm still at v2.2.1

can you delete this settings file (so that a new v3 format settings file is auto generated).

  • Stop node red
  • delete C:\Users\Nu!Reha\.node-red\settings.js (or rename it / move it)
  • start node-red
  • show us the output of the startup log

Laslty, what does where node-red reveal?

Hi @Steve-Mcl
I have done what you said and this is the startup log

PS C:\Users\Nu!Reha> node-red
12 Jun 15:39:40 - [info]

Welcome to Node-RED
===================

12 Jun 15:39:40 - [info] Node-RED version: v2.2.1
12 Jun 15:39:40 - [info] Node.js  version: v20.3.0
12 Jun 15:39:40 - [info] Windows_NT 10.0.19045 x64 LE
12 Jun 15:39:40 - [info] Loading palette nodes
12 Jun 15:39:41 - [info] Settings file  : C:\Users\Nu!Reha\.node-red\settings.js
12 Jun 15:39:41 - [info] Context store  : 'default' [module=memory]
12 Jun 15:39:41 - [info] User directory : \Users\Nu!Reha\.node-red
12 Jun 15:39:41 - [warn] Projects disabled : editorTheme.projects.enabled=false
12 Jun 15:39:41 - [info] Flows file     : \Users\Nu!Reha\.node-red\flows.json
12 Jun 15:39:41 - [info] Creating new flow file
12 Jun 15:39:41 - [warn]

---------------------------------------------------------------------
Your flow credentials file is encrypted using a system-generated key.

If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.

You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.
---------------------------------------------------------------------

12 Jun 15:39:41 - [info] Server now running at http://127.0.0.1:1880/
12 Jun 15:39:41 - [info] Starting flows
12 Jun 15:39:41 - [info] Started flows

Now I have not my flows no more, there is nothing :sweat_smile:

Then if I use the command

where node-red

I obtain nothing

PS C:\Users\Nu!Reha> where node-red
PS C:\Users\Nu!Reha>

because you had some copy paste code in your original settings

Your flows are in c:\home\nol\.node-red

Can you do that in a cmd window.

Also, please show me the content of c:\home\nol\.node-red (top level only)

Ok, they're safe :rofl: thanks!

Using where node-red in cmd it returns

C:\Users\Nu!Reha\AppData\Roaming\npm\node-red
C:\Users\Nu!Reha\AppData\Roaming\npm\node-red.cmd

This is what I have in c:\home\nol\.node-red

I guess now you need to modify the shortcut (C:\Users\Nu!Reha\AppData\Roaming\npm\node-red) to point to C:\Users\Nu!Reha\.node-red\red.js.
For existing files/folders in this folder you can move them to C:\Users\Nu!Reha\.node-red but first let's ask @Steve-Mcl if it's correct

EDIT: I don't know where the Node-RED binary file is located on Windows :thinking:

How can I do this?
Anyway, I have not any red.js file in C:\Users\Nu!Reha\.node-red

Ok so the Node-RED module is stored at C:\Users\Nu!Reha\AppData\Roaming\npm\node_modules\node-red.
This folder also contains a settings file: is userDir commented?
The package.json should show 3.0.2 as the version

Yes, userDir is commented.
The package.json in C:\Users\Nu!Reha\AppData\Roaming\npm\node_modules\node-red show this:

"name": "node-red",
    "version": "2.2.1",
    "description": "Low-code programming for event-driven applications",
    "homepage": "http://nodered.org",
    "license": "Apache-2.0",

(these are the 5 first lines)

:doh: I missed that!

Due to semantic versioning, you are simply re-installing the same version of node-red

Do the upgrade once more, but specify latest (or next if you want the cutting edge stuff)

npm install -g --unsafe-perm node-red@latest

or

npm install -g --unsafe-perm node-red@next

:scream: one more thing learned :heart_eyes: thanks :kissing_heart:

Nothing. :smiling_face_with_tear: :unamused:
I tried both commands in cmd and in Powershell too but nothing happens.
Just this

PS C:\Users\Nu!Reha> npm -g --unsafenpm install -g --unsafe-perm node-red@latest

added 6 packages, removed 12 packages, and changed 287 packages in 8s

41 packages are looking for funding
  run `npm fund` for details

And

PS C:\Users\Nu!Reha> npm -g --unsafenpm install -g --unsafe-perm node-red@next

added 12 packages, removed 6 packages, and changed 287 packages in 19s

42 packages are looking for funding
  run `npm fund` for details

but when i run node-red it returns

PS C:\Users\Nu!Reha> node-red
12 Jun 18:33:36 - [info]

Welcome to Node-RED
===================

12 Jun 18:33:36 - [info] Node-RED version: v2.2.1
12 Jun 18:33:36 - [info] Node.js  version: v20.3.0
12 Jun 18:33:36 - [info] Windows_NT 10.0.19045 x64 LE
12 Jun 18:33:38 - [info] Loading palette nodes

etc.

Can you run

npm root -g

next is "beta" version and latest is "stable" version

PS C:\Users\Nu!Reha> npm root -g
C:\ProgramData\npmglobal\node_modules