question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't build project (CRA + Cap 3 + sqlite)

See original GitHub issue

Describe the bug

Started with a simple create-react-app and installed Capacitor in it (v3). ios platform works fine, but I can’t get the electron platform working after adding the sqlite community plugin. Am I missing something or using the wrong version somewhere?

Looking at the sqlite plugin docs, it looks like they might not be ready for Electron + Capacitor v3 yet … is there a way to specify that I only want to use this plugin for iOS/Android and not for Electron?

To Reproduce

$ npx create-react-app react-electron --template typescript
$ cd react-electron/
$ yarn add @capacitor/core @capacitor/cli
$ npx cap init
$ yarn add @capacitor/ios
$ npx cap add ios
# all good ✅
$ yarn add @capacitor-community/electron
$ npx cap add @capacitor-community/electron
$ npx cap open @capacitor-community/electron
# all good ✅
$ yarn add @capacitor-community/sqlite
$ npx cap sync @capacitor-community/electron
✔ Copying Web App to Electron platform in 32.38ms
⠋ Updating Electron plugins
Will install: @capacitor-community/sqlite@3.0.0
✔ Updating Electron plugins in 8.19s
# all good ✅
$ npx cap doctor @capacitor-community/electron
💊   Capacitor Doctor  💊 

Latest Dependencies:

  @capacitor/cli: 3.1.0
  @capacitor/core: 3.0.2
  @capacitor/android: 3.0.2
  @capacitor/ios: 3.1.0

Installed Dependencies:

  @capacitor/android: not installed
  @capacitor/cli: 3.1.0
  @capacitor/core: 3.0.2
  @capacitor/ios: 3.1.0

[error] Invalid platform: @capacitor-community/electron 
# this is strange 🤔
$ cd electron
$ npm run electron:start

> react-electron@1.0.0 electron:start /Users/agonzalezjr/code/react-electron/electron
> npm run build && electron ./


> react-electron@1.0.0 build /Users/agonzalezjr/code/react-electron/electron
> tsc

CapacitorCommunitySqlite
   CapacitorSQLite
    ["isSecretStored","setEncryptionSecret","changeEncryptionSecret","createConnection","closeConnection","echo","open","close","execute","executeSet","run","query","isDBExists","isDBOpen","isDatabase","isTableExists","deleteDatabase","isJsonValid","importFromJson","exportToJson","createSyncTable","setSyncDate","getSyncDate","addUpgradeStatement","copyFromAssets","getDatabaseList","addSQLiteSuffix","deleteOldDatabases","checkConnectionsConsistency"]

(node:13008) UnhandledPromiseRejectionWarning: TypeError: Cannot convert undefined or null to object
    at Function.getOwnPropertyNames (<anonymous>)
    at Object.setupCapacitorElectronPlugins (/Users/agonzalezjr/code/react-electron/electron/node_modules/@capacitor-community/electron/dist/core/util.js:98:41)
    at ElectronCapacitorApp.init (/Users/agonzalezjr/code/react-electron/electron/build/src/index.js:102:20)
    at /Users/agonzalezjr/code/react-electron/electron/build/src/index.js:127:26
(Use `Electron --trace-warnings ...` to show where the warning was created)
(node:13008) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:13008) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:53 (15 by maintainers)

github_iconTop GitHub Comments

1reaction
jepiqueaucommented, Aug 24, 2021

@IT-MikeS Thanks, I will try tomorrow for me i have done too much computer today

1reaction
digauscommented, Aug 22, 2021

Could you try with the 3.0.4 version of the platform, just curious if it has to do with the changes in the API

Will do. In an hour I or so I can report back 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

How To Compile SQLite
Building SQLite directly from individual source code files is certainly possible, but it is not recommended. For some specialized applications, ...
Read more >
Deploying CAP services with the in-memory SQLite database
Today I will show you how you can deploy a CAP service to Cloud Foundry while using the in-memory SQLite database.
Read more >
c++ - I have problems with sqlite3
I'm pretty new to programming and i have never made any big project. Currently I'm learning c++ language and I want to learn...
Read more >
Building an SQLite Ionic App with Capacitor
In this tutorial we will integrate the Capacitor community SQLite plugin and build a powerful app that first of all loads some seed...
Read more >
Using Databases - SAP Capire
CSV files in your project are picked up by deployments for both SQLite and SAP HANA ... On SAP HANA, only use CSV...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found