• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
MagicMirror Forum
  • Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.

sqlite - anyone use it?

Scheduled Pinned Locked Moved Unsolved Feature Requests
14 Posts 3 Posters 2.8k Views 3 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    bobt
    last edited by Apr 1, 2020, 10:09 PM

    Pretty new to all of this. I was hoping to use sqlite instead of mysql but…
    MM can’t find node_sqlite3.node looking in electron-v6.0-linux-arm. In serveronly mode it works fine. Any hints??

    S 1 Reply Last reply Apr 1, 2020, 10:14 PM Reply Quote 0
    • S Away
      sdetweil @bobt
      last edited by Apr 1, 2020, 10:14 PM

      @bobt it should only run on the node_helper.js side, not in the browser side…

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      1 Reply Last reply Reply Quote 0
      • B Offline
        bobt
        last edited by Apr 1, 2020, 10:23 PM

        Wow - thanks for the quick reply. The db work is in the helper - the require, connect, select. It gets kicked off with socketNotificationReceived. Sends data back with self.sendSocketNotification(“DATA”,self.data);

        1 Reply Last reply Reply Quote 0
        • B Offline
          bobt
          last edited by Apr 1, 2020, 10:25 PM

          If I just send back data without using the sqlite3 it works too.

          S 1 Reply Last reply Apr 1, 2020, 10:38 PM Reply Quote 0
          • S Away
            sdetweil @bobt
            last edited by Apr 1, 2020, 10:38 PM

            @bobt so, it works ok?

            Sam

            How to add modules

            learning how to use browser developers window for css changes

            B 1 Reply Last reply Apr 2, 2020, 12:41 AM Reply Quote 0
            • B Offline
              bobt @sdetweil
              last edited by Apr 2, 2020, 12:41 AM

              @sdetweil It works with fine serveronly. Gets data from the db and passes it to the script. But without the serveronly it chokes when it sees the var sqlite3 = require(“sqlite3”);
              error-
              [2020-04-01 20:36:15.609] [ERROR] Error: Cannot find module ‘/home/pi/MagicMirror/node_modules/sqlite3/lib/binding/electron-v6.0-linux-arm/node_sqlite3.node’

              The module exists in /home/pi/MagicMirror/node_modules/sqlite3/lib/binding but not in the electron folder.

              No idea. I can’t just copy it in - version numbers don’t match.

              S 1 Reply Last reply Apr 2, 2020, 12:43 AM Reply Quote 0
              • S Away
                sdetweil @bobt
                last edited by sdetweil Apr 2, 2020, 1:06 AM Apr 2, 2020, 12:43 AM

                @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

                Sam

                How to add modules

                learning how to use browser developers window for css changes

                B 1 Reply Last reply Apr 2, 2020, 2:00 PM Reply Quote 0
                • B Offline
                  bobt @sdetweil
                  last edited by Apr 2, 2020, 2:00 PM

                  @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.

                  S 1 Reply Last reply Apr 2, 2020, 2:12 PM Reply Quote 0
                  • S Away
                    sdetweil @bobt
                    last edited by Apr 2, 2020, 2:12 PM

                    @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

                    Sam

                    How to add modules

                    learning how to use browser developers window for css changes

                    1 Reply Last reply Reply Quote 0
                    • B Offline
                      bobt
                      last edited by Apr 2, 2020, 3:09 PM

                      Thanks - and one (hopefully last) question. If I wanted sqlite to be available for a number of modules where would I put it?

                      S 1 Reply Last reply Apr 2, 2020, 3:10 PM Reply Quote 0
                      • 1
                      • 2
                      • 1 / 2
                      1 / 2
                      • First post
                        1/14
                        Last post
                      Enjoying MagicMirror? Please consider a donation!
                      MagicMirror created by Michael Teeuw.
                      Forum managed by Sam, technical setup by Karsten.
                      This forum is using NodeBB as its core | Contributors
                      Contact | Privacy Policy