electron: Can't build project (CRA + Cap 3 + sqlite)
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.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 53 (15 by maintainers)
@IT-MikeS Thanks, I will try tomorrow for me i have done too much computer today
Will do. In an hour I or so I can report back 😃