Provide an option node-red -v and --version

CONTEXT

Not infrequently in the forum the question is asked "What version of Node-red, node.js and node-red do you have?"

node -v and npm -v happily report the version and exit

pi@GlassPi:~ $ node -v
v18.20.2
pi@GlassPi:~ $ npm -v
10.5.0

But Node-red attempts to start the program and (if it's already running) errors.
There is more useful info than merely the Node-red version in the output though:

pi@GlassPi:~ $ node-red -v
11 Jun 17:38:38 - [info]

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

11 Jun 17:38:38 - [info] Node-RED version: v3.1.9
11 Jun 17:38:38 - [info] Node.js  version: v18.20.2
11 Jun 17:38:38 - [info] Linux 6.6.28+rpt-rpi-v8 arm64 LE
11 Jun 17:38:39 - [info] Loading palette nodes
11 Jun 17:38:41 - [info] Dashboard version 3.6.5 started at /ui
11 Jun 17:38:42 - [info] Settings file  : /home/pi/.node-red/settings.js
11 Jun 17:38:42 - [info] Context store  : 'default' [module=memory]
11 Jun 17:38:42 - [info] User directory : /home/pi/.node-red
11 Jun 17:38:42 - [warn] Projects disabled : editorTheme.projects.enabled=false
11 Jun 17:38:42 - [info] Flows file     : /home/pi/.node-red/flows.json
11 Jun 17:38:42 - [error] Unable to listen on http://127.0.0.1:1880/
11 Jun 17:38:42 - [error] Error: port in use

PROPOSAL

Allow a command line flag -v & --version which outputs the following but does not attempt to start the editor.
(The colours were inserted by the forum)

Node-RED version: v3.1.9
Settings file  : /home/pi/.node-red/settings.js
Context store  : 'default' [module=memory]
User directory : /home/pi/.node-red
Projects disabled : editorTheme.projects.enabled=false
Flows file     : /home/pi/.node-red/flows.json

Already in Node-RED 4 - šŸŽ‰ Node-RED 4.0 Beta 4 (the final one) released

Although only with --version as -v was already taken.

Good to know (my NR 4 machine is currently down).

Does it report more than just the version no, as suggested?

It reports the Node-RED version, node.js version and os version:

$ node-red --version
Node-RED v4.0.0-beta.4
Node.js v18.18.2
Darwin 20.6.0 x64 LE

The other bits require more of the runtime to get initialised than we'd really want to do for this simple command.

2 Likes

With the introduction of Dashboard 2, it would be really helpful if that information could also be added, as users don't always make it clear in the forum, although I'm mindful of what you have said above -

I thought the same regarding node-red-dashboard but decided that versions of installed nodes was a step too far.

The info is available via cat .node-red/package.json
(I expect other less familiar operating systems have something similar too) :upside_down_face:

I was suggesting an exception just for the dashboard due to it's unique integration with the core.

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