Npm, versioning and palette manager confusions

We need a proper design proposal and discussion for how the script will handle the upgrade. Personally I think its clear there are a number of options that could exist on the script to provide users a bit more discretion and control over what it does - whilst having a good default behaviour for users who just want it to work.

I would prefer we don't thrash out the details at the bottom of a thread in the forum and had a discussion on github that we can track changes against.

1 Like

OK - have created an issue for discussion Changes required for updating to Node14 / Node-RED v2 · Issue #13 · node-red/linux-installers · GitHub

1 Like

So... right now, do we have any suggestions other than the ones above that don't work (for me anyway). I have a perfectly up to date NR setup on Pi4 other than it is running node -v = v10.24.1 - and I have currently have no idea how to upgrade from here. The two unsolvable issues seem to be i2c and sqlite...

Here's what my rmote powerup says.
Linux rpi419buster 5.10.17-v7l+ #1403 SMP Mon Feb 22 11:33:35 GMT 2021 armv7l
and node-red is 1.3.2



Well - as long as the updating nodes went ok - (does npm outdated report anything ?) - then you should be ok to push node.js up to 14 (as per Npm, versioning and palette manager confusions - #52 by dceejay)

Or you should be able to get to 12 by running
sudo apt remove nodejs
then running the install script. That should work ok now that all your nodes are up to date. Or when you say that none of the suggestions have worked that this still doesn't work. In which case we need the log to work out why.

Hi Dave

I've just now ran npm outdated....

Package Current Wanted Latest Location
dateformat 3.0.3 3.0.3 4.5.1 global
node-red-node-sqlite 0.3.7 0.3.7 0.6.0 global

No idea why it is showing anything outdated after all the updating I've done.. and updating the two nodes - should there be a -g tag on the update - seems to be suggesting these are global?

OK, this is starting to make some sense. Somehow you have installed the sqlite node globally, so it isn't getting updated. I suggest you remove it
npm remove -g node-red-node-sqlite
then make sure it is installed locally
npm i --unsafe-perm node-red-node-sqlite
note, no -g, and restart node-red. I don't know why you have dateformat installed. Is it something you use in your flows? It probably isn't relevant to the issues here.


It gets even more complicated.. I did the install as you requested – from the pi folder….

Result was: up to date in 0.092s

So, I did the same again without the -g

Result was a proper uninstall.

I then checked the .node-red folder – still had a sqlite install in there…. So… I uninstalled THAT (without the -g).

Could you please confirm therefore – what folder should I be sitting in, in order to do the new install?

While waiting I tried going into NR (no sqlite) and used the pallette manager to install sqlite - that failed...(after stopping and restarting NR). So I uninstalled the sqlite it installed into /home/pi/.node-red/node_modules.... and installed it the way you suggested above - from the /home/pi folder...a long time later (but no ERRORS)... I ended up with sqlite in the home/pi/node_modules folder and ran node-red...

STILL no sqlite - yet before I started all of this I had SQLITE working (remember I'm on nodejs 10).

Finally, the non-global --unsafe-perm version in .node-red folder - restarted node-red - works...

but now. npm outdated returns:

Package     Current  Wanted  Latest  Location
dateformat    3.0.3   3.0.3   4.5.1  global
sqlite3       4.0.9   4.2.0   5.0.2  global

I thought the point of this was to install the latest sqlite?

Welcome to Node-RED

16 Apr 17:31:43 - [info] Node-RED version: v1.3.2
16 Apr 17:31:43 - [info] Node.js  version: v10.24.1
16 Apr 17:31:43 - [info] Linux 5.10.17-v7l+ arm LE
16 Apr 17:31:44 - [info] Loading palette nodes
16 Apr 17:31:49 - [info] Worldmap version 2.13.2
16 Apr 17:31:49 - [info] Dashboard version 2.28.2 started at /ui
16 Apr 17:31:50 - [info] Settings file  : /home/pi/.node-red/settings.js
16 Apr 17:31:50 - [info] HTTP Static    : /home/pi/.node-red/public
16 Apr 17:31:50 - [info] Context store  : 'default' [module=localfilesystem]
16 Apr 17:31:50 - [info] User directory : /home/pi/.node-red
16 Apr 17:31:50 - [warn] Projects disabled : set editorTheme.projects.enabled=true to enable
16 Apr 17:31:50 - [info] Flows file     : /home/pi/.node-red/flows.json
16 Apr 17:31:50 - [info] Server now running at
16 Apr 17:31:50 - [info] Starting flows
16 Apr 17:31:52 - [info] Started flows
16 Apr 17:31:52 - [info] [sqlitedb:6e9a0125.59bc4] opened /home/pi/dbs/iot.db ok
16 Apr 17:31:52 - [info] [sqlitedb:fdbe27fe.fb7848] opened /home/pi/dbs/iot.db ok
16 Apr 17:31:52 - [info] [sqlitedb:33875a87.57ade6] opened /home/pi/dbs/iot.db ok
16 Apr 17:31:52 - [info] [tasmota-mqtt-broker:34268cd3.bfa344] Connected to broker: mqtt://
16 Apr 17:31:52 - [info] [mqtt-broker:4c682b3a.2ab5c4] Connected to broker: mqtt://
16 Apr 17:31:59 - [info] [] Message sent: 250 2.0.0 OK  1618587119 m15sm7803175wrx.32 - gsmtp


Hi Pete.

All nodes should be installed into the userDir (~/.node-red). Only Node-RED itself should be installed globally.

The only real reason to install any npm package globally is for when a package implements a command line command that you want to be able to run anywhere. Everything else should be locally installed.

If you get stuck with something, you can always just delete it manually. For a globally installed package, you can find out where it lives with:

npm -g list npm-module-name

On my Debian system, that is /usr/lib/node_modules/. Just delete the folder with the matching name.

That isn't node-red-contrib-sqlite, that is a global install off the the sqlite3 module. How you have that I have no idea. It shouldn't be necessary as installing the sqlite node should have installed the correct sqlite3 version under it.
I suggest you uninstall the global sqlite3 module
npm remove -g sqlite3
and check that the sqlite node has pulled in the correct module.
npm list sqlite3 should show

$ npm list sqlite3
tigger@1.0.0 /home/colinl/.node-red
└─┬ node-red-node-sqlite@0.6.0
  └── sqlite3@4.2.0 

That is from the .node-red folder of course. If you do everything from that folder then you won't go wrong, though npm commands with -g don't care where they are run. If sqlite3 doesn't appear there then remove and install the sqlite node again as it must have been confused by the global install.

You might like to remove the dateformat module the same way, but first search for that in the editor to see if you are using it, and check in settings.js in case you have referenced it there.

This happened earlier. Same again

npm remove -g sqlite3
up to date in 0.103s

pi@rpi419buster:~:23:24[130]> npm list sqlite3
└── sqlite3@4.0.9

IfI do that from the .node-red dir

pi@rpi419buster:.node-red:23:26[0]> npm list sqlite3
node-red-project@0.0.1 /home/pi/.node-red
└─┬ node-red-node-sqlite@0.6.0
└── sqlite3@4.2.0

Dateformat sorted earlier thanks by getting rid of the /home/pi/node_modules version.

So now it seems "all" I have to do is upgrade node to 14??

It WORKED! Wheee..

After all that I did:
sudo nano /etc/apt/sources.list.d/nodesource.list
(changed the references in there from 10.x to 14.x)
sudo apt update && sudo apt full-upgrade
and in the .node-red folder....
sudo apt update && sudo apt full-upgrade
a quick reboot and
npm rebuild
Then I started Node-Red and ALL IS WELL - thanks a lot guys... I'll upgrade my blog accordingly.

1 Like

That is yet another install of the sqlite3 node, in folder /home/pi. Presumably at some point you installed it manually from that folder. Unless you know that want nodejs modules installed in that folder (which you don't for the usual node-red install) then you can safely remove the folder /home/pi/node_modules. It is just wasting space.

Absolutely right Colin - I got rid of it last night.... indeed I'm wondering why there is a nod_modules folder at all under /home/pi - it has lots in it and much seems to replicate that in /home/pi/.node-red - remember my installation dates back years as I've slowly added features to my home control and never wanted to start from scratch.

I had a good cleanup day yesterday thanks mainly to feedback from yourself, Dave and Julian - only hindered by problems making SSD clones - but even that may now be resolved - it LOOKS like a dicky USB3-to SATA connector as I replaced one lead and now I have 4 SSD clones of yesterday's success. I may well investigate if that /home/pi/node_modules folder is even necessary if my run of luck continues.

The /home/pi/node_modules folder is probably as a result of occasional attempted installations from the home folder instead of .node-red. It is easy to do. Rename it and you will soon find if it messes anything up. Make a note to delete it in a few weeks if you don't find a problem.

Thanks Colin - I've JUST sat down and I was pondering that - I'll do exactly that to see what happens....
Done - in /home/pi - mv node_modules node_maybe - and I found a huge tar.gz file - thats gone, too.

Everything still works after reboot..... magic.

Update - I ditched that /home/pi/node_modules folder successfully - and all is well - just in time for another update - message this morning said NR 1.3.3 is out - and I only just upgraded to 1.3.2 - oh well :slight_smile:

If you just want to install a node-red upgrade then all you need do is
sudo npm install -g --unsafe-perm node-red

MMM, updating NR to 3.3 all went well except that "Manage Palette" produced "Failed to load node catalog - click on browser console for more information". I restarted the browser on my PC, nothing happened. I erbooted my Rsapberry Pi 4 and all is well. Colin - I just saw your post above now... I coudl have done that - but I used the usual upgrade script. All seems well.

1 Like

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