# How to get installed version of NR?

**URL:** <https://discourse.nodered.org/t/how-to-get-installed-version-of-nr/58669>\
**Category:** General\
**Created:** [19 February 2022 22:55 UTC](https://discourse.nodered.org/t/how-to-get-installed-version-of-nr/58669 "2022-02-19T22:55:04Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nodi.Rubrum](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nodi.rubrum/32/107482_2.png) [@Nodi.Rubrum](https://discourse.nodered.org/u/Nodi.Rubrum)\
**Post date:** [19 February 2022 22:55 UTC](https://discourse.nodered.org/t/how-to-get-installed-version-of-nr/58669/1 "2022-02-19T22:55:04Z")

</div>

I was using the following to get the latest version of NR available, and it still works...

```auto
npm search node-red | grep Low-code | cut -d '|' -f4-5

```

And I was using the following to get the installed version, but this seems to be broken at the moment...

```auto
npm ls -g --depth=0 | grep node-red | cut -d '@' -f 2

```

Any suggestions as to how to find the installed version of NR? This is where I really wish the 'node-red-project' line showed the correct installed version. But that is a question we discussed a long time ago. 🙂

npm list | grep node-red  
node-red-project@0.0.1 /home/pi/.node-red  
├── node-red-contrib-bme280@1.0.0  
├── node-red-contrib-counter@0.1.6  
├── node-red-contrib-cron-plus@1.5.6  
├── node-red-contrib-fs-ops@1.6.0  
├── node-red-contrib-linux-network-stats@0.2.5  
├── node-red-contrib-loop-processing@0.5.1  
├── node-red-contrib-md5@1.0.4  
├── node-red-contrib-os@0.2.1  
├── node-red-contrib-play-audio@2.5.0  
├── node-red-contrib-ring-buffer@0.10.0  
├── node-red-contrib-simple-gate@0.5.2  
├── node-red-contrib-traffic@0.2.1  
├── node-red-contrib-ui-led@0.4.11  
├── node-red-dashboard@3.1.5  
├── node-red-node-mysql@1.0.0  
├── node-red-node-pi-gpio@2.0.1  
├── node-red-node-pi-gpiod@0.4.0  
├── node-red-node-ping@0.3.1  
├── node-red-node-random@0.4.0  
├── node-red-node-serialport@0.15.0  
├── node-red-node-smooth@0.1.2  
├── node-red-node-ui-list@0.3.6  
├── node-red-node-ui-table@0.3.12

And of course a few other past variants seem to be failing as well...

$ npm list -g node-red  
/usr/local/lib  
└── (empty)

$ npm list node-red  
node-red-project@0.0.1 /home/pi/.node-red  
└── (empty)

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [19 February 2022 23:07 UTC](https://discourse.nodered.org/t/how-to-get-installed-version-of-nr/58669/2 "2022-02-19T23:07:55Z")

</div>

My way of updating NR is this command:

`bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered)`

---

<div class="post-metadata">

**Author:** ![Nodi.Rubrum](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nodi.rubrum/32/107482_2.png) [@Nodi.Rubrum](https://discourse.nodered.org/u/Nodi.Rubrum)\
**Post date:** [19 February 2022 23:10 UTC](https://discourse.nodered.org/t/how-to-get-installed-version-of-nr/58669/3 "2022-02-19T23:10:46Z")

</div>

@Trying_to_learn, Sorry, No, NOT updating, that is NOT the question... need installed version.

I checked an older install, and the older method works on older installations...  
# npm list -g node-red  
/usr/lib  
└── node-red@2.1.4

So something changed with how deployment is done, which apparently breaks the old method of determining the INSTALLED version.

You cannot have good auditing or QC or QA controls unless you can properly document the existing environment. This should be a standard feature any solution. A point I have made before, that reliance on 3rd party tool, i.e. npm, to find the installed version of an solution is not a good idea per se. Again, I suggest that $ node-red -v would be a good idea.

Speaking of where the version information is displayed, how does the flow wire editor, know what version is installed? Is it just a static string? Or dynamic value derived in some way? Clearly the editor shows the version installed, right?

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [19 February 2022 23:13 UTC](https://discourse.nodered.org/t/how-to-get-installed-version-of-nr/58669/4 "2022-02-19T23:13:02Z")

</div>

If you want to get the installed version....

Just to the right of the `DEPLOY` button is a _burger_ button/menu.

Click it and you get the _drop down_.

The version is at the bottom.

---

<div class="post-metadata">

**Author:** ![Nodi.Rubrum](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nodi.rubrum/32/107482_2.png) [@Nodi.Rubrum](https://discourse.nodered.org/u/Nodi.Rubrum)\
**Post date:** [19 February 2022 23:18 UTC](https://discourse.nodered.org/t/how-to-get-installed-version-of-nr/58669/5 "2022-02-19T23:18:28Z")

</div>

That is useless... for automation or any realistic methodology of environment documentation. You can't go every device and manual look up the version, are you really suggesting that is a good method? You can't be.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [19 February 2022 23:19 UTC](https://discourse.nodered.org/t/how-to-get-installed-version-of-nr/58669/6 "2022-02-19T23:19:30Z")

</div>

O.k.a.y... above my knowledge than. Sorry.

---

<div class="post-metadata">

**Author:** ![Nodi.Rubrum](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nodi.rubrum/32/107482_2.png) [@Nodi.Rubrum](https://discourse.nodered.org/u/Nodi.Rubrum)\
**Post date:** [19 February 2022 23:21 UTC](https://discourse.nodered.org/t/how-to-get-installed-version-of-nr/58669/7 "2022-02-19T23:21:10Z")

</div>

Actually this an old issue... that should be address by development effort. You can only suggest what you can know of, of course. I found a work-around, that is now broken.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [19 February 2022 23:24 UTC](https://discourse.nodered.org/t/how-to-get-installed-version-of-nr/58669/8 "2022-02-19T23:24:08Z")

</div>

`npm -g info node-red version`

↑ assumes node-red is installed globally

---

<div class="post-metadata">

**Author:** ![Nodi.Rubrum](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nodi.rubrum/32/107482_2.png) [@Nodi.Rubrum](https://discourse.nodered.org/u/Nodi.Rubrum)\
**Post date:** [19 February 2022 23:33 UTC](https://discourse.nodered.org/t/how-to-get-installed-version-of-nr/58669/9 "2022-02-19T23:33:31Z")

</div>

To find the **available** version you can use list or info. Not the installed version.

On a 2.1.4 install the command returns...  
2.2.2

On a 2.2.2 install the command returns...  
$ npm list -g node-red  
/usr/local/lib  
└── (empty)

$ npm list node-red  
node-red-project@0.0.1 /home/pi/.node-red  
└── (empty)

So, that specific command does not show the installed version at all. Where as my old command on older installations worked...

On older 2.1.4...  
# npm ls -g --depth=0 | grep node-red | cut -d '@' -f 2  
2.1.4

On 2.2.2...  
# npm ls -g --depth=0 | grep node-red | cut -d '@' -f 2  
(Nothing Results)

$ npm ls --depth=0 | grep node-red  
node-red-project@0.0.1 /home/pi/.node-red  
├── node-red-contrib-bme280@1.0.0  
├── node-red-contrib-counter@0.1.6  
├── node-red-contrib-cron-plus@1.5.6  
├── node-red-contrib-fs-ops@1.6.0  
├── node-red-contrib-linux-network-stats@0.2.5  
├── node-red-contrib-loop-processing@0.5.1  
├── node-red-contrib-md5@1.0.4  
├── node-red-contrib-os@0.2.1  
├── node-red-contrib-play-audio@2.5.0  
├── node-red-contrib-ring-buffer@0.10.0  
├── node-red-contrib-simple-gate@0.5.2  
├── node-red-contrib-traffic@0.2.1  
├── node-red-contrib-ui-led@0.4.11  
├── node-red-dashboard@3.1.5  
├── node-red-node-mysql@1.0.0  
├── node-red-node-pi-gpio@2.0.1  
├── node-red-node-pi-gpiod@0.4.0  
├── node-red-node-ping@0.3.1  
├── node-red-node-random@0.4.0  
├── node-red-node-serialport@0.15.0  
├── node-red-node-smooth@0.1.2  
├── node-red-node-ui-list@0.3.6  
├── node-red-node-ui-table@0.3.12

(Of course none of the above are 2.2.2)

This is either because something changed with how deployment is done, presented, or something has changed with how npm or such works, or whatever the case. It does not change the fact or issue that NR should have some way via CLI or node, to report its current installed version information.

So, my questions stands... how does the wire editor know what version is installed, is it a static value? Or dynamic determined? Is there some way to present that information other than using npm? Or if npm is the only option? How can one find such that is not a human action dependent sequence? Something via CLI, that automation can invoke is what is needed. If there is a CLI method that works, like before, I can do the rest, via Ansible or whatever.

---

<div class="post-metadata">

**Author:** ![Andrei](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/andrei/32/10446_2.png) [@Andrei](https://discourse.nodered.org/u/Andrei)\
**Post date:** [19 February 2022 23:46 UTC](https://discourse.nodered.org/t/how-to-get-installed-version-of-nr/58669/10 "2022-02-19T23:46:49Z")

</div>

> [@Nodi.Rubrum](#):
>
> It does not change the fact or issue that NR should have some way via CLI

via CLI

pi@pi:~ $ `node-red admin info node-red`  
Module: node-red  
Version: 2.2.0

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [19 February 2022 23:46 UTC](https://discourse.nodered.org/t/how-to-get-installed-version-of-nr/58669/11 "2022-02-19T23:46:51Z")

</div>

This is one of many reasons that I never install Node-RED globally but instead put it in its own folder with the userDir as a sub-folder. With that approach, you can simply query the package.json file of the parent folder when in Node-RED.

I expect that the Node-RED editor is passed the data from one of the node.js modules which of course are running in the correct context to be able to query its own package.json file.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [19 February 2022 23:51 UTC](https://discourse.nodered.org/t/how-to-get-installed-version-of-nr/58669/12 "2022-02-19T23:51:04Z")

</div>

`node -p "require('/usr/lib/node_modules/node-red/package.json').version"`

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [19 February 2022 23:51 UTC](https://discourse.nodered.org/t/how-to-get-installed-version-of-nr/58669/13 "2022-02-19T23:51:56Z")

</div>

Which is OK but not resilient since it may not be in that location at all 🙂 It certainly isn't when running on Windows.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [19 February 2022 23:53 UTC](https://discourse.nodered.org/t/how-to-get-installed-version-of-nr/58669/14 "2022-02-19T23:53:27Z")

</div>

Of course but as node-red could be installed _anywhere_ this solution expects the user to specify the instance path.

---

<div class="post-metadata">

**Author:** ![Nodi.Rubrum](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nodi.rubrum/32/107482_2.png) [@Nodi.Rubrum](https://discourse.nodered.org/u/Nodi.Rubrum)\
**Post date:** [19 February 2022 23:54 UTC](https://discourse.nodered.org/t/how-to-get-installed-version-of-nr/58669/15 "2022-02-19T23:54:47Z")

</div>

@TotallyInformation I use the standard script. So not sure why the old method worked since NR should be local under /home/pi scope.

@Andrei, Yahoo!

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [19 February 2022 23:55 UTC](https://discourse.nodered.org/t/how-to-get-installed-version-of-nr/58669/16 "2022-02-19T23:55:33Z")

</div>

NOTE: @Andrei solution will only work if node-red is running.

The one i offered above doesnt need node-red running.

---

<div class="post-metadata">

**Author:** ![Nodi.Rubrum](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nodi.rubrum/32/107482_2.png) [@Nodi.Rubrum](https://discourse.nodered.org/u/Nodi.Rubrum)\
**Post date:** [19 February 2022 23:56 UTC](https://discourse.nodered.org/t/how-to-get-installed-version-of-nr/58669/17 "2022-02-19T23:56:02Z")

</div>

@TotallyInformation Good point... I can't say that I have ever run NR on Windows.

@Steve-Mcl , I can design the automation, i.e. Ansible, to try the applicable method, if NR is not active, or is.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [20 February 2022 00:00 UTC](https://discourse.nodered.org/t/how-to-get-installed-version-of-nr/58669/18 "2022-02-20T00:00:10Z")

</div>

If you have access to a custom node, you can get the version using `RED.version()`

> [@Nodi.Rubrum](#):
>
> I can't say that I have ever run NR on Windows.

The real point is that a global install of something using npm could end up in various different places.

---

<div class="post-metadata">

**Author:** ![Nodi.Rubrum](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nodi.rubrum/32/107482_2.png) [@Nodi.Rubrum](https://discourse.nodered.org/u/Nodi.Rubrum)\
**Post date:** [20 February 2022 00:00 UTC](https://discourse.nodered.org/t/how-to-get-installed-version-of-nr/58669/19 "2022-02-20T00:00:42Z")

</div>

I see one odd issue... for some reason one of my test 2.2.2 instances, the method is not working.

# node-red admin info node-red  
Failed to connect to [http://localhost:1880](http://localhost:1880)

Odd, localhost is resolving (local) to 127.0.0.1 and pingable. Something is tripping something up, this is going to be interesting to track down. A raw download via curl, connects and I see the html.

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [20 February 2022 00:25 UTC](https://discourse.nodered.org/t/how-to-get-installed-version-of-nr/58669/20 "2022-02-20T00:25:46Z")

</div>

> [@Nodi.Rubrum](#):
>
> On a 2.1.4 install the command returns...  
> 2.2.2
> 
> On a 2.2.2 install the command returns...  
> $ npm list -g node-red  
> /usr/local/lib  
> └── (empty)

What exactly does `npm list -g node-red` return on your 2.1.4 install?

What version of npm/node.js are using using in those two installs? Did you set them up in the same way?

We haven't changed where Node-RED gets installed. But for some reason your 2.2.2 install using `/usr/local/lib` for its global path, and I would guess your 2.1.4 install will report `/usr/lib`.

[Next page](https://discourse.nodered.org/t/how-to-get-installed-version-of-nr/58669.md?page=2)
