Build with predefined SQLite Database

Hi All,
I have made a simple App with a predefined database (SQLite) that I have located under the asset folder.
When working with EXPO GO everything works but when I try to build an APK with EAS build
then my APP stall … seems like it does not load the database ???
Do I need to something special to build with the SQLite Database ?
How is it possible to see if this is included ?

Hey @edmg,

It seemed the build that failed uses a package @databases/expo. Can you make sure that package is installed and included in your project since the error was the module not getting resolved.

Also, can you verify you have followed the instructions provided here in the documentation: SQLite - Expo Documentation to import an existing database?

Hi aman,
when I try to install @databases/expo I have this fault :

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: 5elementapp@1.0.0
npm ERR! Found: expo-sqlite@10.3.0
npm ERR! node_modules/expo-sqlite
npm ERR! expo-sqlite@“~10.3.0” from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer expo-sqlite@"^8.0.0" from @databases/expo@5.0.0
npm ERR! node_modules/@databases/expo
npm ERR! @databases/expo@“^5.0.0” from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

So do I have to downgrade expo-sqlite to 8.0.0 ???

Downgrading the expo-sqlite might not be compatible with the Expo SDK version your uses. I’d suggest contacting the library author(s) of @databases/expo and see if they have further suggestions or upgrading their library.

Do you know where I can contact the library author(s) of @databases/expo ?

additional question, when I run “npm view expo-sqlite”

============================
expo-sqlite@10.3.0 | MIT | deps: 1 | versions: 29
Provides access to a database that can be queried through a WebSQL-like API

keywords: react-native, expo, sqlite, websql, sql

dist
.tarball: https://registry.npmjs.org/expo-sqlite/-/expo-sqlite-10.3.0.tgz
.shasum: c2d7fa2f6777b8a8730a38cf77b2c57541ada66b
.integrity: sha512-i9jyOfDw472Ueqnhl4LvspSpBVRzeuGjPWFwDYnaBgNOV3HLeK9Q6P5ixV2/on5RenfL4jsxOQtgeZAXke9/UQ==
.unpackedSize: 66.8 kB

dependencies:
@expo/websql: ^1.0.1

Then there is actually no dependency to databases/expo only to expo/websql.
It do seems that @databases/expo dependo on expo-sqlite, so why do I need the @databases/expo library ???

According to https://www.npmjs.com/package/@databases/expo the Git repository is at:
https://github.com/ForbesLindesay/atdatabases/tree/master/packages/expo

But it looks to me like it should be safe to use the latest version of expo-sqlite with @databases/expo, since according to the expo-sqlite changelog, there are no breaking changes between version 8.0.0 and the latest version other than dropping support for older versions of iOS.

Given the supposed lack of breaking changes in expo-sqlite version 10.x, I think it should be safe to run:

npm i @databases/expo --legacy-peer-deps

EDIT: The fact that it runs OK for you in Expo Go also supports this, because Expo Go will include the later version of expo-sqlite.

But the safest option would be to create an issue in the ForbesLindesay/atdatabases repository to ask them to increase the version of expo-sqlite specified in their package.json or to use a version range that allows for 10.x.

No, the dependency is the other way around. @databases/expo has a peer dependency on expo-sqlite. If you are not actually using @databases/expo in your JavaScript code, then remove the dependency.

1 Like

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.