Giter Club home page Giter Club logo

electron-with-sqlite3's Introduction

Purpose

This repository contains sample code for the following areas:

  1. Creating a new BrowserWindow and how to show and destroy it from the MainProcess.
  2. Sending data between RendererProcess and MainProcess in Electron app.
  3. Using IPCRenderer and IPCMain objects.
  4. Connecting Sqlite3 using Knex library.
  5. Building and reading queries using Knex library.

The shortcut for showing dev tools on windows in Electron is Command + Alt + I on MacOS.

Notes

When sending data between RenderProcess and MainProcess, there are two important code pieces:

  1. IPCMain and IPCRenderer
  2. BrowserWindow.webContents.send()

WebContents contains events, etc. for a window. IPC means inter-process communication. The idea here is events. You can fire an event by using send() method along with data to pass, and the subscribers listening to it get the data passed.

Also, when I was working with Sqlite3, I got errors with it not being found. Therefore, I had to install electron-rebuild dev-dependency and rebuilt the electron with it by calling npm run rebuild. package.json has the setting for the rebuild command.

electron-with-sqlite3's People

Contributors

kant avatar recursivelydesigned avatar tarikguney avatar tonydiep avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

electron-with-sqlite3's Issues

Cannot find module 'sqlite3'

I cloned your repo in hopes of getting sqlite3 to work with Electron after trying for several hours, looking at different resources online. Unfortunately your repo doesn't seem to work either.

This is what I did immediately after cloning your repo

First I ran npm install and got the error that the comment needs to be removed, so I did that.

Then when running npm install again there were a lot of install errors related to sqlite (npm ERR! Failed at the [email protected] install script.).

Then, after ignoring that warning and running npm run rebuild followed by npm start I get the error Electron failed to install correctly, please delete node_modules/electron and try installing again. So I ran npm install --save electron (no errors here).

With this done I ran npm start and got lots of error messages, starting with Error: Cannot find module 'sqlite3'.

Note; I'm on macOS Mojave.

does not build due to outdated dependencies

npm i fails with

node-pre-gyp ERR! Tried to download(403): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v3.1.13/node-v64-linux-x64.tar.gz 
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v64 ABI) (falling back to source compile with node-gyp) 
node-pre-gyp ERR! Tried to download(undefined): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v3.1.13/node-v64-linux-x64.tar.gz 
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v64 ABI) (falling back to source compile with node-gyp) 

npm i fails due to comment in package.json

npm i results in

npm ERR! file /home/tonydiep/Projects/electron-with-sqlite3/package.json
npm ERR! code EJSONPARSE
npm ERR! JSON.parse Failed to parse json
npm ERR! JSON.parse Unexpected token / in JSON at position 140 while parsing near '...: "electron .",
npm ERR! JSON.parse     // You need to run: ...'
npm ERR! JSON.parse Failed to parse package.json data.
npm ERR! JSON.parse package.json must be actual JSON, not just JavaScript.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.