I am trying to access an SQLite database from Node-Red. Node-Red is unable to open the DB. My OS is Ubuntu 18.04.3.
My flow and SQLite node definitions are provided below. The inject and debug nodes only have default values. I am keeping it very simple since this is my first attempt at SQLite with Node-Red.
When I deploy my flow, I get the following error:
The db has read-write-execute privileges for all users. It is local on my machine and I am the only one using it.
Any idea what could be causing the issue ?
All right here is how I solved the issue.
I was also having problems opening .csv files. By looking at other similar posts it seemed to be a user privilege problem which could not be resolved, even by changing the file privileges with chmod
.
I had installed all the node components using different mediums:
These different installation mediums might have caused privilege issues. So I uninstalled everything.
I then reinstalled everything from the command line. Node packages were installed globally (i.e. with "-g" attribute):
sudo apt install nodejs
sudo apt install npm
sudo npm install -g node-red
sudo npm install -g node-red-dashboard
sudo npm install -g node-red-node-sqlite
I then confirmed npm could see everything as global packages:
sudo npm list -g --depth 0
I now launch node-red in a shell:
node-red
Then by going to a browser and typing:
localhost:1880
the node-red browser loads, all dashboard and sqlite nodes are available and I am able to read sqlite & csv files.
*** Note regarding installing node-red sub-packages ***
Node-red sub-packages (node-red-dashboard, node-red-node-sqlite, ...) can be installed from npm or from the node-red browser.
However I noticed a few things:
a sub-package installed from the browser will not show up when typing npm list -g --depth 0
.
a sub-package installed with sudo npm -g <sub-package>
will show up with npm list -g --depth 0
.
packages listed in the browser will not all show up with command npm list <package>
.
So I decided to play it safe and install all my node-red sub-packages with npm list
. First I search for my sub-package in the node-red browser palett list, I retrieve the sub-package name, then I install it from the shell using sudo npm -g <sub-package>
.
Consistency solved the problem: installing everything from the shell as global packages.