# Problem with multiple context stores

**URL:** <https://discourse.nodered.org/t/problem-with-multiple-context-stores/52955>\
**Category:** General\
**Created:** [29 October 2021 21:02 UTC](https://discourse.nodered.org/t/problem-with-multiple-context-stores/52955 "2021-10-29T21:02:03Z")\
**Posts on this page:** 9\
**Page:** 2

<div class="post-metadata">

**Author:** ![Glake01](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/glake01/32/5950_2.png) [@Glake01](https://discourse.nodered.org/u/Glake01)\
**Post date:** [30 October 2021 21:03 UTC](https://discourse.nodered.org/t/problem-with-multiple-context-stores/52955/22 "2021-10-30T21:03:19Z")

</div>

> [@Colin](#):
>
> sudo apt remove nodejs

I removed nodejs then ran the script without the node16 option and got an error and the upgrade aborted. The install log is:

```auto
Started : Sat Oct 30 14:48:05 MDT 2021
Running for user pi at /home/pi
Found global nodes: :

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

Reading package lists...
Building dependency tree...
Reading state information...
Package 'nodered' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Versions: node:missing npm:missing
OLD nodejs 0 :
NEW nodejs 16 :

```

I ran the script again with the `--node16` option and everything seemed to go well, but still get the following:

```auto
pi@RPi3FT:~ $ nodejs-v
-bash: nodejs-v: command not found
pi@RPi3FT:~ $ node -v
v16.13.0
pi@RPi3FT:~ $ npm -v
8.1.0
pi@RPi3FT:~ $ apt-cache policy nodejs
nodejs:
  Installed: (none)
  Candidate: 10.24.0~dfsg-1~deb10u1
  Version table:
     10.24.0~dfsg-1~deb10u1 500
        500 http://raspbian.raspberrypi.org/raspbian buster/main armhf Packages

```

The install log is:

```auto
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

Reading package lists...
Building dependency tree...
Reading state information...
Package 'nodered' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Using n
   installed : v16.13.0 (with npm 8.1.0)

Versions: node:v16.13.0 npm:8.1.0
npm WARN using --force Recommended protections disabled.
Now install Node-RED

added 290 packages in 1m
2.1.3
Now create basic package.json for the user and move any global nodes
Running npm rebuild
rebuilt dependencies successfully
Installing extra nodes: node-red-node-pi-gpio@latest node-red-node-random@latest node-red-node-ping@latest node-red-contrib-play-audio@late$

up to date in 6s
Now add the shortcut and start/stop/log scripts to the menu
Now add systemd script and configure it for pi
ln: failed to create symbolic link '/usr/bin/python': File exists
Now add launcher to top bar, add cpu temp example, make sure ping works
The user `pi' is already a member of `gpio'.
Memory : 1.0G
Started : Sat Oct 30 14:48:42 MDT 2021
Finished: Sat Oct 30 14:51:38 MDT 2021

```

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [31 October 2021 07:20 UTC](https://discourse.nodered.org/t/problem-with-multiple-context-stores/52955/23 "2021-10-31T07:20:45Z")

</div>

Nothing wrong there that I can see. Does node red not work?

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [31 October 2021 07:32 UTC](https://discourse.nodered.org/t/problem-with-multiple-context-stores/52955/24 "2021-10-31T07:32:20Z")

</div>

@Glake01  
Can we just clarify the situation 🙂

I think you are saying that you run the install, it upgrades to node16 fine if you use the --node16 flag

But, if you immediately re-run the install script again, instead of it just noticing that you are up-to-date - it fails and tries/reverts you to node10

Have I got this right?

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [31 October 2021 09:37 UTC](https://discourse.nodered.org/t/problem-with-multiple-context-stores/52955/25 "2021-10-31T09:37:57Z")

</div>

> [@Glake01](#):
>
> ```auto
> pi@RPi3FT:~ $ nodejs-v
> -bash: nodejs-v: command not found
> 
> ```

You have a typo, try `nodejs -v` instead of `nodejs-v`

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [31 October 2021 10:12 UTC](https://discourse.nodered.org/t/problem-with-multiple-context-stores/52955/26 "2021-10-31T10:12:11Z")

</div>

I think it is sorted now, but waiting for the OP to confirm. The problem was that there were two versions of nodejs installed at the same time. nodejs 10 was installed using apt, but also nodejs 16 was installed via the script. Having uninstalled the apt version then I believe all is well. The dual nodejs situation appeared to confuse the install script.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [31 October 2021 10:14 UTC](https://discourse.nodered.org/t/problem-with-multiple-context-stores/52955/27 "2021-10-31T10:14:09Z")

</div>

> [@Glake01](#):
>
> ```auto
> Using n
> installed : v16.13.0 (with npm 8.1.0)
> 
> ```

Actually I have just noticed this. You have installed `n` which also may give problems with the install script. Perhaps that is how the issue arose in the first place.

---

<div class="post-metadata">

**Author:** ![Glake01](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/glake01/32/5950_2.png) [@Glake01](https://discourse.nodered.org/u/Glake01)\
**Post date:** [31 October 2021 16:20 UTC](https://discourse.nodered.org/t/problem-with-multiple-context-stores/52955/28 "2021-10-31T16:20:07Z")

</div>

@Colin and @cymplecy

Yes node red was working each time I upgraded, however I was trying to ensure that I ended up with the latest node.js and npm. I wasn't sure if the fact that v10.24.0 was still showing up was a problem, and not sure why, after using the script to upgrade to node v16x, the next upgrade without the `--nodexx` option would fail and revert back to v10x.

> [@Colin](#):
>
> I think it is sorted now, but waiting for the OP to confirm. The problem was that there were two versions of nodejs installed at the same time. nodejs 10 was installed using apt, but also nodejs 16 was installed via the script. Having uninstalled the apt version then I believe all is well. The dual nodejs situation appeared to confuse the install script.

I think I'm starting to understand from the replies that there were two nodejs versions installed, I didn't know two versions could exist (it's not only the script that might have been confused 🙂).

@Paul-Reed

> You have a typo, try nodejs -v instead of nodejs-v

Thanks Paul

> [@Colin](#):
>
> Actually I have just noticed this. You have installed `n` which also may give problems with the install script. Perhaps that is how the issue arose in the first place.

I vaguely recall having installed `n`. This installation was a few years old before I started upgrading and I started that a year or so ago, and I must have found `n` on the web as a way of trying to upgrade nodejs and npm so the node red script wouldn't fail. This was before I learned that the `--nodexx` option was something to add after the last `)` in the script.

I still am not sure how to upgrade nodejs and npm on their own (i.e. not using the node red script), the [nodejs.org](http://nodejs.org) documentation doesn't appear to cover that.

However, my takaway from all this is - don't try to install nodejs or npm on my own, leave it to the node red script.

**Thank you all again! I'm learning!**

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [31 October 2021 21:54 UTC](https://discourse.nodered.org/t/problem-with-multiple-context-stores/52955/29 "2021-10-31T21:54:36Z")

</div>

> [@Glake01](#):
>
> don't try to install nodejs or npm on my own, leave it to the node red script.

Yes, it can be tricky on a Pi. I use the script.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [14 November 2021 21:55 UTC](https://discourse.nodered.org/t/problem-with-multiple-context-stores/52955/30 "2021-11-14T21:55:17Z")

</div>

Closed on 14 November 2021 21:55 UTC

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

[Previous page](https://discourse.nodered.org/t/problem-with-multiple-context-stores/52955.md?page=1)
