typeorm/typeorm · critical · DriverPackageNotInstalledError
Capacitor package has not been found installed. Please run "
Error message
Capacitor package has not been found installed. Please run "npm install @capacitor-community/sqlite".
What it means
Thrown as DriverPackageNotInstalledError by CapacitorDriver.loadDependencies when this.driver is falsy — i.e. no @capacitor-community/sqlite connection instance was supplied via the DataSource `driver` option. The Capacitor driver does not auto-require; it expects the caller to hand in the configured SQLiteConnection from the plugin, so an absent instance is a setup error.
Source
Thrown at src/driver/capacitor/CapacitorDriver.ts:104
if (
this.options.journalMode &&
["DELETE", "TRUNCATE", "PERSIST", "MEMORY", "WAL", "OFF"].indexOf(
this.options.journalMode,
) !== -1
) {
await connection.execute(
`PRAGMA journal_mode = ${this.options.journalMode}`,
)
}
return connection
}
protected loadDependencies(): void {
this.sqlite = this.driver
if (!this.driver) {
throw new DriverPackageNotInstalledError(
"Capacitor",
"@capacitor-community/sqlite",
)
}
}
}
View on GitHub (pinned to 04ff4daedc)
Solutions
- Install and configure the plugin: npm install @capacitor-community/sqlite, then instantiate SQLiteConnection and pass it as DataSource option `driver`.
- Ensure plugin customUrl/permissions setup (iOS/Android) completes before building the DataSource.
- If unit-testing outside Capacitor, inject a stub driver object that implements the methods you call.
Example fix
// before
new DataSource({ type:'capacitor', database:'app.db' /* no driver */ })
// after
import { CapacitorSQLite, SQLiteConnection } from '@capacitor-community/sqlite'
const sqlite = new SQLiteConnection(CapacitorSQLite)
new DataSource({ type:'capacitor', database:'app.db', driver: sqlite }) Defensive patterns
Strategy: validation
Validate before calling
// Ensure the plugin instance is provided before init
if (!options.driver) throw new Error('Capacitor SQLiteConnection missing — pass options.driver') Type guard
const hasCapacitorDriver = (o: any): boolean => !!o?.driver
Prevention
- Instantiate SQLiteConnection from @capacitor-community/sqlite before DataSource init.
- Pass it via the `driver` option.
- In tests, inject a stub driver.
When it happens
Trigger: Creating a DataSource with type 'capacitor' but omitting options.driver; initializing before the Capacitor plugin's SQLiteConnection is instantiated; running TypeORM in a non-Capacitor environment without providing a mock driver.
Common situations: Mobile app bootstrap order (plugin not ready before DataSource init); web/desktop builds that don't register @capacitor-community/sqlite; tutorial code copied without wiring the plugin.
Related errors
- SQLite package has not been found installed. Please run "npm
- Query runner already released. Cannot run queries anymore.
- Cannot connect to database "nativescript-sqlite". Please ins
- Cannot connect to database "oracledb". Please install it int
- Transaction is not started yet, start transaction before com
AI-assisted analysis of typeorm/typeorm@04ff4daedc (2026-08-03).
Data as JSON: /data/errors/0d822f7c22527ded.json.
Report an issue: GitHub.