Read the statement by Michael Teeuw here.
sqlite - anyone use it?
-
@bobt for your module, you added that as a dependency in package.json, then do an npm install in your module folder.
it should be in
‘/home/pi/MagicMirror/modules/modulename/node_modules/sqlite
-
@sdetweil Thank you Sam for all your help. I created that folder and just copied the module in. I get:
[2020-04-02 07:42:08.104] [ERROR] WARNING! Could not load config file. Starting with default configuration. Error found: Error: Cannot find module ‘/home/pi/MagicMirror/node_modules/sqlite3/lib/binding/electron-v6.0-linux-arm/node_sqlite3.node’
I’m ready to just start over. If I started with a fresh install of MM and wanted to install sqlite how would I go about it? Should I be in the module folder? the MM folder?
Thanks again for your help. -
@bobt as its used by the module, it should be in the module folder
just copy is always bad
npm install sqlite --save
–save will put it into the package.json in this folder
you should have one(package.json), then u can keep track of your dependencies…
npm init will create one
-
Thanks - and one (hopefully last) question. If I wanted sqlite to be available for a number of modules where would I put it?
-
@bobt i don’t know
u might be able to put in in the base, and then change your require to include the path to the ~/MagicMirror/node_modules/sqlite version
-
@bobt
did u find a solution for your problem ? -
@Perlchamp you should create a package.json for the module
by doing npm init in the module folder, and answering the setup questins.
the questions only add text to the package.json, nothing elseand then
then install your dependencies
npm install --save sqlite3
–save means add this to the package.json dependencies section
when u are done, you can send the package.json to another person,
and they can run npm install in the module folder and get the same
supporting code installed for this moduleand if you asked for a SPECIFIC version of some library,
that would be recorded in the package.json too, so the other user would get
the same level of the dependency -
@Perlchamp
Thanks everyone for your help. What I was doing was using MMM-MarineWeather By Grena https://github.com/grenagit
as a template to create a MarineTides version. In my simplicity I was loading the tide predictions from NOAA into a table and trying to use sqlite. The problems caused me to do a better job. Now I link to the NOAA website for the info. This allows the module to get the tide info from any (US) location. Works well. I’ll clean it up and try to add it to Git. May need help with that.
Thanks again.