How to get installed version of NR?

If you enter node-red -? you get the help back and the version number is in the first line:

pi@fastpi:~ $ node-red -?
Node-RED v2.1.4
Usage: node-red [-v] [-?] [--settings settings.js] [--userDir DIR]
                [--port PORT] [--title TITLE] [--safe] [flows.json]
       node-red admin <command> [args] [-?] [--userDir DIR] [--json]

Options:
  -p, --port     PORT  port to listen on
  -s, --settings FILE  use specified settings file
      --title    TITLE process window title
  -u, --userDir  DIR   use specified user directory
  -v, --verbose        enable verbose output
      --safe           enable safe mode
  -D, --define   X=Y   overwrite value in settings file
  -?, --help           show this help
  admin <command>      run an admin command

Documentation can be found at http://nodered.org
2 Likes

@zenofmud , LOL! How did I miss that one!

I use:

pi @ raspberrypi: ~ $ node-red --version
20 Feb 15:10:02 - [info]

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

20 Feb 15:10:02 - [info] Node-RED version: v2.2.2
20 Feb 15:10:02 - [info] Node.js version: v16.14.0
20 Feb 15:10:02 - [info] Linux 5.10.92-v7l + arm LE
20 Feb 15:10:03 - [info] Loading palette nodes
20 Feb 15:10:05 - [info] Dashboard version 3.1.6 started at / ui
20 Feb 15:10:05 - [info] Settings file: /home/pi/.node-red/settings.js
20 Feb 15:10:05 - [info] Context store: 'default' [module = memory]
20 Feb 15:10:05 - [info] User directory: /home/pi/.node-red
20 Feb 15:10:05 - [warn] Projects disabled: editorTheme.projects.enabled = false
20 Feb 15:10:05 - [info] Flows file: /home/pi/.node-red/flows.json
20 Feb 15:10:05 - [warn]

@Frida Although that may work, It also will attempt to start a Node-Red instance on the default port.

Yes I know. But when it runs in advance, nothing happens, otherwise you can stop it again.

The method I've been using pulls it from .node-red/.config.nodes.json

[{"id":"b6faf7d8.b5efa8","type":"tab","label":"Update?","disabled":false,"info":""},{"id":"874a3d4e.9b666","type":"http request","z":"b6faf7d8.b5efa8","name":"http request to https://nodered.org","method":"GET","ret":"txt","paytoqs":"ignore","url":"https://nodered.org","tls":"","persist":false,"proxy":"","authType":"","x":320,"y":80,"wires":[["90243cc1.87edc"]]},{"id":"90243cc1.87edc","type":"html","z":"b6faf7d8.b5efa8","name":"","property":"payload","outproperty":"payload","tag":".node-red-latest-version","ret":"text","as":"multi","x":650,"y":80,"wires":[["05cf562f0b953db6"]]},{"id":"212aff481b0685cb","type":"inject","z":"b6faf7d8.b5efa8","name":"","props":[{"p":"payload"}],"repeat":"259200","crontab":"","once":true,"onceDelay":"0.1","topic":"","payloadType":"str","x":110,"y":120,"wires":[["874a3d4e.9b666","b3ca5d44d94eb375"]]},{"id":"e0fa0b169f53173a","type":"json","z":"b6faf7d8.b5efa8","name":"","property":"payload","action":"obj","pretty":false,"x":590,"y":120,"wires":[["23865497589f6baa"]]},{"id":"9a682b8e06cbc47e","type":"function","z":"b6faf7d8.b5efa8","name":"old version","func":"msg.payload = \"2.0.1\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":850,"y":160,"wires":[["77873223bd69beae"]]},{"id":"77873223bd69beae","type":"join","z":"b6faf7d8.b5efa8","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":1010,"y":120,"wires":[["2710a272a2cc1b37"]]},{"id":"12208d376a521184","type":"debug","z":"b6faf7d8.b5efa8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1410,"y":100,"wires":[]},{"id":"2710a272a2cc1b37","type":"switch","z":"b6faf7d8.b5efa8","name":"","property":"payload.0","propertyType":"msg","rules":[{"t":"eq","v":"payload.1","vt":"msg"},{"t":"neq","v":"payload.1","vt":"msg"}],"checkall":"true","repair":false,"outputs":2,"x":1130,"y":120,"wires":[["9d5c0bd73938b521"],["a3dbd1ecd809488a"]]},{"id":"9d5c0bd73938b521","type":"function","z":"b6faf7d8.b5efa8","name":"No update","func":"msg.payload = \"The installed version is \" + msg.payload[0] + \", no update is necessary at this time.\"\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1270,"y":100,"wires":[["12208d376a521184"]]},{"id":"a3dbd1ecd809488a","type":"function","z":"b6faf7d8.b5efa8","name":"update","func":"msg.payload = \"The installed version is \" + msg.payload[0] + \", an update to version \" + msg.payload[1] + \" is available.\"\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1250,"y":140,"wires":[["5145c9412b49c0fc","83110640972f117c"]]},{"id":"5145c9412b49c0fc","type":"debug","z":"b6faf7d8.b5efa8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1410,"y":140,"wires":[]},{"id":"b3ca5d44d94eb375","type":"file in","z":"b6faf7d8.b5efa8","name":"","filename":"C:/Users/Bannd/.node-red/.config.nodes.json","format":"utf8","chunk":false,"sendError":false,"encoding":"none","allProps":false,"x":350,"y":120,"wires":[["e0fa0b169f53173a"]]},{"id":"83110640972f117c","type":"link out","z":"b6faf7d8.b5efa8","name":"Update checked","links":["966d7ce16488d73f"],"x":1375,"y":180,"wires":[]},{"id":"9e3906315247bdf2","type":"inject","z":"b6faf7d8.b5efa8","name":"manual test","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"str","x":630,"y":160,"wires":[["9a682b8e06cbc47e"]]},{"id":"e90c1af7ea9b30d8","type":"comment","z":"b6faf7d8.b5efa8","name":"How often to check","info":"","x":130,"y":160,"wires":[]},{"id":"e9e2d19cccb1c1d0","type":"comment","z":"b6faf7d8.b5efa8","name":"Send to a notification flow","info":"","x":1310,"y":220,"wires":[]},{"id":"57e5bc1434255e11","type":"comment","z":"b6faf7d8.b5efa8","name":"replace location for your system","info":"","x":370,"y":160,"wires":[]},{"id":"05cf562f0b953db6","type":"function","z":"b6faf7d8.b5efa8","name":"chomp left","func":"msg.payload = msg.payload.substr(1, +Infinity)\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":850,"y":80,"wires":[["77873223bd69beae"]]},{"id":"b850824df4055e47","type":"comment","z":"b6faf7d8.b5efa8","name":"No need to send this one","info":"","x":1310,"y":60,"wires":[]},{"id":"23865497589f6baa","type":"function","z":"b6faf7d8.b5efa8","name":"filter version","func":"msg.payload = msg.payload[\"node-red\"].version;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":850,"y":120,"wires":[["77873223bd69beae"]]}]

The file location would have to be changed depending on your system setup of course.

There is no such command line parameter as --version. You are needlessly starting a NR instance.

Use -? as mentioned earlier.

The --version was a suggestion, but -? trumps that idea to be sure.

node-red -? doesn't seem to work for me. Appears to be due to zsh.

> node-red -?
zsh: no matches found: -?
> node-red --help
Node-RED v2.2.2
Usage: node-red [-v] [-?] [--settings settings.js] [--userDir DIR]
                [--port PORT] [--title TITLE] [--safe] [flows.json]
       node-red admin <command> [args] [-?] [--userDir DIR] [--json]

Options:
  -p, --port     PORT  port to listen on
  -s, --settings FILE  use specified settings file
      --title    TITLE process window title
  -u, --userDir  DIR   use specified user directory
  -v, --verbose        enable verbose output
      --safe           enable safe mode
  -D, --define   X=Y   overwrite value in settings file
  -?, --help           show this help
  admin <command>      run an admin command

Documentation can be found at http://nodered.org

try this node-red --help | grep Node-RED

I'm aware, hence the second command in the screenshot, thank you though. node-red -? works fine when I switch to bash. Just thought I'd mention it, in case any future readers have this issue.

And for completeness

Windows...

node-red --help | findStr Node-RED
image

Linux...

node-red --help | grep Node-RED
image

ANY OS (using node)

node -p "require('path/to/node-red/package.json').version"

e.g. ubuntu

e.g. windows

3 Likes

Tangent question... how to find the installation date? Thinking just stat the nod-red executable?

# stat /usr/bin/node-red
File: /usr/bin/node-red -> ../lib/node_modules/node-red/red.js
Size: 35 Blocks: 0 IO Block: 4096 symbolic link
Device: b302h/45826d Inode: 17309 Links: 1
Access: (0777/lrwxrwxrwx) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2022-02-19 21:40:12.665240108 +0000
Modify: 2022-02-19 21:40:12.665240108 +0000
Change: 2022-02-19 21:40:12.665240108 +0000
Birth: 2022-02-19 21:40:12.665240108 +0000

So the birth time stamp?

The installation script I use tracks the invocation stamp, so that is a reference but always nice to have a validation check, such as catch if someone else reinstalled an application at a later date from the official stamp.

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