node-red-nodes
node-red-nodes copied to clipboard
node-red-node-sqlite - bullseye installation issue
Which node are you reporting an issue on?
What are the steps to reproduce?
What happens?
What do you expect to happen?
Please tell us about your environment:
- [x] Node-RED version:
- [x] node.js version:
- [x] npm version:
- [x] Platform/OS:
- [ ] Browser:
Node-RED 2.2.2 nodejs v14.19.1 npm 6.14.16 OS - Raspbian bullseye
npm install node-red-node-sqlite appears to work but then I get waiting for missing types to be registered - sqlite - sqlitedb
- 32 or 64 bit Raspberry Pi OS?
- What is in the the logs when it fails to load the modules?
- Exactly where did you run the
npm install
command? - what is the output if you run the following commands
mkdir test cd test npm install sqlite3
32bit - RPi3 A+ 16Gb microSD card. sqlite3 is already installed.
It's node-red-node-sqlite that is giving the error.
That wasn't what I asked. Please follow the steps I laid out in the last point and post the output as I need to see if the sqlite3 npm modules installs properly and builds it's native component.
You also haven't answered the questions about where you ran the initial npm install node-red-node-sqlite
command or supplied the logs I asked for.
Okay, I am just trying the instructions that you posted, I will let know know in the next few minutes. I am a newbie and because sqlite3 was installed and appears to be working I did not consider this might be causing the issue until now.
I ran the npm install node-red-node-sqlite from ./node-red
While sqlite3 is installing its giving me lots of warnings 'this statement may fall through' and its taking a while on my RPi3 A+
The command npm install sqlite3 as per your instruction locks up the RPi at line 197088. This was also happening when I tried to install npm install node-red-node-sqlite, so I now assume that this command tries to install sqlite3 and on my OS Bullseye it locks at this line. I have installed on previous OS versions so not sure why. I am unable to provide a log because the only way now is to reboot the Pi. Any ideas?
Without the logs I really can't say.
Are you 100% sure it had totally hung and just was busy building the native part? Did you try to log in remotely via SSH? Also rather than power cycle just leave it be for several hours.
I have left it a number of times, even overnight. I am sure that it just locks up. Did not try SSH, but keyboard etc does not respond.
I implemented a workaround. I installed sqlite on RPi4 previously and it worked. So I took the microSD card from my RPi3 A+ and installed installed from RPi4. It worked. I then placed the microSD card back in my RPi3 A+ and checked and it worked. I have implemented a quick CRUD and all appears okay. Not a proper solution, but it point to an unsupported architecture issue? Much obliged to you for working with me on this.
When I try to install sudo npm install node-red-node-sqlite --loglevel verbose the error was (image):
I'm using the Debian11.4 Bullseye IoT Image 2022-09-02, then I install without problems "npm install -g node-pre-gyp" but the error repeat with "npm install node-red-node-sqlite --loglevel verbose":
npm verb node v12.22.12
npm verb npm v8.19.1
npm ERR! code 1
npm ERR! path /home/debian/node_modules/node-red-node-sqlite/node_modules/sqlite3
npm ERR! command failed
npm ERR! command sh -c -- node-pre-gyp install --fallback-to-build
npm ERR! internal/modules/cjs/loader.js:818
npm ERR! throw err;
npm ERR! ^
npm ERR!
npm ERR! Error: Cannot find module 'nopt'
npm ERR! Require stack:
npm ERR! - /home/debian/node_modules/@mapbox/node-pre-gyp/lib/node-pre-gyp.js
npm ERR! - /home/debian/node_modules/@mapbox/node-pre-gyp/lib/main.js
npm ERR! - /home/debian/node_modules/@mapbox/node-pre-gyp/bin/node-pre-gyp
npm ERR! at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
npm ERR! at Function.Module._load (internal/modules/cjs/loader.js:667:27)
npm ERR! at Module.require (internal/modules/cjs/loader.js:887:19)
npm ERR! at require (internal/modules/cjs/helpers.js:74:18)
npm ERR! at Object.
npm ERR! A complete log of this run can be found in: npm ERR! /root/.npm/_logs/2022-09-03T16_33_13_782Z-debug-0.log
@Zupayruna1
First why are you running npm with sudo? (npm really doen't like running as root these days, it drops nearly all permissions as soon as possible.
It looks like you are in the debian
users home dir (which is probably not where you want to be either, by default node-red nodes should be installed in the Node-RED userDir which defaults to ~/.node-red
not the users home dir. Nodes should be installed as the user that will run Node-RED and that normally really shouldn't be root unless you are very aware of the security issues around that.
Next, is there a directory called nopt
in /home/debian/node_modules
?
Installing node-pre-gyp
won't help because the build is using the scoped version of the package @mapbox/node-pre-gyp
which is the much newer version.
The problem is with building the native component for the underlying sqlite3 node
@Zupayruna1
First why are you running npm with sudo? (npm really doen't like running as root these days, it drops nearly all permissions as soon as possible.
because when I saw the logs I had problems with permission
It looks like you are in the
debian
users home dir (which is probably not where you want to be either, by default node-red nodes should be installed in the Node-RED userDir which defaults to~/.node-red
not the users home dir. Nodes should be installed as the user that will run Node-RED and that normally really shouldn't be root unless you are very aware of the security issues around that.
Sure, but my Nodered came installed and only I need the system nodered for try with examples not for a business project. I'm beginner in node red
Next, is there a directory called
nopt
in/home/debian/node_modules
?
no there is not
Installing
node-pre-gyp
won't help because the build is using the scoped version of the package@mapbox/node-pre-gyp
which is the much newer version.The problem is with building the native component for the underlying sqlite3 node
I tried with this https://github.com/mapbox/node-pre-gyp/issues/477 : -> sudo apt-get install -y build-essential python npm install node-pre-gyp npm install -g node-gyp
and I didnt have errors during installation npm install node-red-node-sqlite --loglevel verbose But I can't see the node sqlite in nodered GUI
I tried with ur code "npm install sqlite3" but the system error was:
hardillb thank u so much!
But I can't see the node sqlite in nodered GUI
Because as I said, nodes need to be installed into the Node-RED userDir typlically /home/debian/.node-red
not the users Home Directory e.g. /home/debian
when you install NR nodes.
The errors about not empty directories is because you have probably messed up all the permissions under the node_modules
directory by running things with sudo
.
I would suggest stopping Node-RED, backing up your flows just to be safe (under /home/debian/.node-red
) and deleting the the whole /home/debian/.node-red/node_modules
directory. Then restarting Node-RED and using the Manage Palette option to re-install any nodes that are missing.
It's the easiest way to fix the permissions problem, and don't run NR as root or install anything other nodes using sudo
Sorry, re-reading that error in the new image (Please don't post images of text, post the text and use tripple back ticks to format it) you may have your Node-RED userDir set to /var/lib/node-red/.node-red
which is strange and not something I would recommend because those paths again tend to need root access to write to.
If you still have problems you should probably post to the forum where somebody may have time to help you unpick it, but I'm going to close this issue as the OP is fixed and this is not an actual problem with the node, it is more to do with the state you've got your environment in.