Help! Broke my installation

I was installing a new node via Palette manager and noticed that some others needed updating. All the node-red-contrib-* worked fine but I got an error on node-red-node-sqlite and node-red-pushsafer. In the Palette, the first shows MODULE NOT FOUND and the second (which I am not so concerned about) shows a red square next to pushsafer in the 'in use' section.

Restarting NR fails with:

` +-------------------------------------------------
Waiting for missing types to be registered:

  • sqlitedb
  • sqlite

If there's no straightforward way to fix this problem, I do have a recent backup that I could restore from. What directories would need to be restored.

Thanks in advance for any help!

You haven't told us what sort of installation of node red you have, or what OS you are running under. But assuming it is not a docker install then, in a command window, go into your .node-red folder and run
npm remove sqlite
npm install sqlite
and copy/paste the result here.

Edit: Also start node-red in a command window and post the full output here.

Sorry, it's on a Raspberry Pi under Raspbian. Thank you for your super-quick response (esp as it's Sunday!)

The remove|install sqlite commands proceeded normally. I am still seeing the same error in nodered:

Node-RED[19941]: 3 Dec 15:07:09 - [info] Waiting for missing types to be registered:
Node-RED[19941]: 3 Dec 15:07:09 - [info]  - sqlitedb
Node-RED[19941]: 3 Dec 15:07:09 - [info]  - sqlite
systemd[1]: Stopping Node-RED graphical event wiring tool...
Node-RED[19941]: 3 Dec 15:43:45 - [info] Stopping flows
Node-RED[19941]: 3 Dec 15:43:45 - [info] Stopped flows
systemd[1]: nodered.service: Succeeded.
systemd[1]: Stopped Node-RED graphical event wiring tool.
systemd[1]: nodered.service: Consumed 24.256s CPU time.
systemd[1]: Started Node-RED graphical event wiring tool.
Node-RED[21719]: 3 Dec 15:44:36 - [info]
Node-RED[21719]: Welcome to Node-RED
Node-RED[21719]: ===================
Node-RED[21719]: 3 Dec 15:44:36 - [info] Node-RED version: v3.1.1
Node-RED[21719]: 3 Dec 15:44:36 - [info] Node.js  version: v16.19.1
Node-RED[21719]: 3 Dec 15:44:36 - [info] Linux 5.15.84-v7l+ arm LE
Node-RED[21719]: 3 Dec 15:44:38 - [info] Loading palette nodes
Node-RED[21719]: 3 Dec 15:44:45 - [info] Dashboard version 3.6.1 started at /ui
Node-RED[21719]: 3 Dec 15:44:47 - [error] [uibuilder:package-mgt:writePackageJson] Failed to copy package.json to backup.  /home/pi/.node-red/uibuilder
Node-RED[21719]: 3 Dec 15:44:47 - [warn] ------------------------------------------------------
Node-RED[21719]: 3 Dec 15:44:47 - [warn] [node-red-node-sqlite/sqlite] Error: Cannot find module '/home/pi/.node-red/node_modules/sqlite3/lib/binding/napi-v6-linux-glibc-arm/node_sqlite3.node'
Node-RED[21719]: Require stack:
Node-RED[21719]: - /home/pi/.node-red/node_modules/sqlite3/lib/sqlite3-binding.js
Node-RED[21719]: - /home/pi/.node-red/node_modules/sqlite3/lib/sqlite3.js
Node-RED[21719]: - /home/pi/.node-red/node_modules/.node-red-node-sqlite-3zfPEYD0/sqlite.js
Node-RED[21719]: - /usr/lib/node_modules/node-red/node_modules/@node-red/registry/lib/loader.js
Node-RED[21719]: - /usr/lib/node_modules/node-red/node_modules/@node-red/registry/lib/index.js
Node-RED[21719]: - /usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/nodes/index.js
Node-RED[21719]: - /usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/index.js
Node-RED[21719]: - /usr/lib/node_modules/node-red/lib/red.js
Node-RED[21719]: - /usr/lib/node_modules/node-red/red.js
Node-RED[21719]: 3 Dec 15:44:47 - [warn] ------------------------------------------------------
Node-RED[21719]: 3 Dec 15:44:47 - [info] Settings file  : /home/pi/.node-red/settings.js
Node-RED[21719]: 3 Dec 15:44:47 - [info] Context store  : 'default' [module=localfilesystem]
Node-RED[21719]: 3 Dec 15:44:47 - [info] User directory : /home/pi/.node-red
Node-RED[21719]: 3 Dec 15:44:47 - [warn] Projects disabled : editorTheme.projects.enabled=false
Node-RED[21719]: 3 Dec 15:44:47 - [info] Flows file     : /home/pi/.node-red/flows.json
Node-RED[21719]: 3 Dec 15:44:47 - [info] Server now running at
Node-RED[21719]: 3 Dec 15:44:47 - [warn]
Node-RED[21719]: ---------------------------------------------------------------------
Node-RED[21719]: Your flow credentials file is encrypted using a system-generated key.
Node-RED[21719]: If the system-generated key is lost for any reason, your credentials
Node-RED[21719]: file will not be recoverable, you will have to delete it and re-enter
Node-RED[21719]: your credentials.
Node-RED[21719]: You should set your own key using the 'credentialSecret' option in
Node-RED[21719]: your settings file. Node-RED will then re-encrypt your credentials
Node-RED[21719]: file using your chosen key the next time you deploy a change.
Node-RED[21719]: ---------------------------------------------------------------------
Node-RED[21719]: 3 Dec 15:44:47 - [info] +-----------------------------------------------------
Node-RED[21719]: 3 Dec 15:44:47 - [info] | uibuilder v6.7.0 initialised đź“—
Node-RED[21719]: 3 Dec 15:44:47 - [info] | root folder: /home/pi/.node-red/uibuilder
Node-RED[21719]: 3 Dec 15:44:47 - [info] | Using Node-RED's webserver at:
Node-RED[21719]: 3 Dec 15:44:47 - [info] |
Node-RED[21719]: 3 Dec 15:44:47 - [info] | Installed packages:
Node-RED[21719]: 3 Dec 15:44:47 - [info] +-----------------------------------------------------
Node-RED[21719]: 3 Dec 15:44:48 - [info] Waiting for missing types to be registered:
Node-RED[21719]: 3 Dec 15:44:48 - [info]  - sqlitedb
Node-RED[21719]: 3 Dec 15:44:48 - [info]  - sqlite

Did you upgrade or change node version?

You likely need to do an npm rebuild

cd ~/.node-red
npm rebuild

Or, uninstall and reinstall the node-red-node-sqlite

cd ~/.node-red
npm remove node-red-node-sqlite
npm install node-red-node-sqlite

Thank you! I thought I had already done that (but it was suspiciously quick). Problem was that I was not in ~/.node-red when I ran it.

All is working again now.

I spoke a bit too soon! Although the flows start up correctly now, I am still seeing MODULE_NOT_FOUND under node-red-node-sqlite in the Palette. I tried doing an remove and install of node-red-node-sqlite, but I hit an error with a not empty directory. I don't want to delete this without being sure I am not going to cause further harm. Here's the removal attempt:

~/.node-red $ npm remove node-red-node-sqlite
npm ERR! syscall rename
npm ERR! path /home/pi/.node-red/node_modules/detect-libc
npm ERR! dest /home/pi/.node-red/node_modules/.detect-libc-pGdKpy0q
npm ERR! errno -39
npm ERR! ENOTEMPTY: directory not empty, rename '/home/pi/.node-red/node_modules/detect-libc' -> '/home/pi/.node-red/node_modules/.detect-libc-pGdKpy0q'

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/pi/.npm/_logs/2023-12-03T16_11_43_599Z-debug-0.log

There is a discussion here about similar problems with updating nodes.
They seem to suggest that deleting the file / folder - in your case /home/pi/.node-red/node_modules/detect-libc ? will let you successfully install.
It's not a very helpful error message though, does it mean rename it to .detect-libc-pGdKpy0q or does the -> mean something else?

Delete this :point_up: and do it again

Thank you all for your help. I tried deleting the directory and next time I just got a different directory. I kept deleting these and running the remove again (on the basis that the initial letter of each was further along the alphanumeric order) until I was able to get the command to run all the way through. I then did npm install node-red-node-sqlite. Although this ran to completion, when I restarted nodeRED everything was such a mess (complaints still that sqlite was still missing and failure to start flows as a result) that I decided I would restore from a backup and now all is back to normal.

I've learnt not to try updating a node in the Palette unless its name contains 'contrib'. I don't really understand why pushsafer doesn't have contrib in its name, but there was a slew of warnings about potential security exploits when I was trying to troubleshoot it alongside by sqlite woes that I have removed it from my flows, deleted its config nodes and removed it from my system.

I seem to remember the was a problem with a specific version of npm. You probably want to update that.

Also, you didn't answer:

Sorry, I missed that. No, I did not update node or npm. I am running homebridge on the same platform and it's using node v20.10.0 whereas nodeRED seems to be using v16.19.1 (or at least that's what I get with node -v). I'm unclear what determines which node nodeRED is using.

Press ctrl+shift+v, type system info, that will tell you exactly what node version node-red is using.

As for staying homebridge reports v20 but node -v reports v16 suggests either docker is involved or a node version manager is installed. Both can pose their own complications.

Where do I type ctrl+shift+v? That sounds very Windows-y to me.

That's what I don't get. There's no Docker or nvm installation.

I'm sure you could look at all the keys on your keyboard and try a similar named key like cmnd.

If you mean I should type these keys when in the web editor, they (or any alternative combinations) don't do anything. I can't find anything like that in the keyboard shortcuts. (All of those point to items I can get to through the web interface menu system.) I'm surprised it's not in a config file somewhere.

Anyway, I'll press on in ignorance for now. Thanks for your help!

I got it wrong too :man_facepalming:

It's "press ctrl+shift+p" (shortcut - I never said "type")

Here is the non shortcut version:

If you ever get stuck with these things, just note that you can always delete the node_modules folder. All you need to do afterwards is to do an npm install afterwards to get everything set up again.

Of course, on a Pi, the rebuild can take a few minutes.

Thanks. That works for me now. I wasn't distinguishing between 'press' and 'type' - I understood what you meant. Apologies that I was a bit short. I was getting frustrated by that point!

Thank you. That's useful to know.

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