n8n-io/n8n · critical · DriverPackageNotInstalledError
SQLite package has not been found installed. Try to install
Error message
SQLite package has not been found installed. Try to install it: npm install sqlite3 --save
What it means
DriverPackageNotInstalledError('SQLite', 'sqlite3') is thrown from SqliteDriver.loadDependencies when this.options.driver is unset and require('sqlite3') throws. The sqlite3 native module is required for the sqlite driver to function; this fires during connect().
Source
Thrown at packages/@n8n/typeorm/src/driver/sqlite/SqliteDriver.ts:184
await run(`PRAGMA busy_timeout = ${this.options.busyTimeout}`);
}
// we need to enable foreign keys in sqlite to make sure all foreign key related features
// working properly. this also makes onDelete to work with sqlite.
await run(`PRAGMA foreign_keys = ON`);
return databaseConnection;
}
/**
* If driver dependency is not given explicitly, then try to load it via "require".
*/
protected loadDependencies(): void {
try {
const sqlite = this.options.driver || require('sqlite3');
this.sqlite = sqlite.verbose();
} catch (e) {
throw new DriverPackageNotInstalledError('SQLite', 'sqlite3');
}
}
/**
* Auto creates database directory if it does not exist.
*/
protected async createDatabaseDirectory(fullPath: string): Promise<void> {
await mkdirp(path.dirname(fullPath));
}
/**
* Performs the attaching of the database files. The attachedDatabase should have been populated during calls to #buildTableName
* during EntityMetadata production (see EntityMetadata#buildTablePath)
*
* https://sqlite.org/lang_attach.html
*/
protected async attachDatabases() {
// @todo - possibly check number of databases (but unqueriable at runtime sadly) - https://www.sqlite.org/limits.html#max_attachedView on GitHub (pinned to 5ac6606e81)
Solutions
- Install sqlite3 in the runtime workspace: 'npm install sqlite3'.
- If on an unusual architecture, ensure a prebuilt binary exists or install build tools (python, make, g++) so node-gyp can compile.
- Pass options.driver = sqlite3 explicitly to bypass require if your bundling puts sqlite3 somewhere non-standard.
- After a Node major upgrade, rebuild native modules (npm rebuild sqlite3).
Example fix
// before // DB_TYPE=sqlite but sqlite3 native module missing -> error // after npm install sqlite3 # if native build fails: npm rebuild sqlite3
Defensive patterns
Strategy: validation
Validate before calling
// At startup, probe that sqlite3 loads on this platform.
if (config.dbType.startsWith('sqlite')) {
try { require('sqlite3'); } catch (e) {
throw new Error('sqlite3 native module failed to load: ' + e.message);
}
}
Try / catch
import { DriverPackageNotInstalledError } from '@n8n/typeorm';
try {
await dataSource.initialize();
} catch (e) {
if (e instanceof DriverPackageNotInstalledError && e.args?.[0] === 'SQLite') {
failStartup('SQLite driver needs sqlite3; run npm install sqlite3 && npm rebuild sqlite3');
}
throw e;
}
Prevention
- Pin sqlite3 as a hard dependency; rebuild native modules on Node upgrades.
- Ensure the deployment image has a prebuilt binary for its arch or a working build toolchain.
- Run a smoke test that loads sqlite3 in CI for each target image.
- Pass options.driver explicitly if bundling sqlite3 non-standardly.
When it happens
Trigger: DB_TYPE=sqlite (or options.type='sqlite'/'sqlite-pooled') is configured but the 'sqlite3' package is not resolvable, or its native binding failed to load (often surfaced as a require error).
Common situations: An alpine/slim Docker image missing the build toolchain so sqlite3's native binding never compiled; a node version upgrade broke the prebuilt sqlite3 binary; node_modules pruning; a cross-architecture deploy (e.g. arm64 image with only x64 prebuilds).
Related errors
- Postgres package has not been found installed. Try to instal
- Wrong driver: "${driverType}" given. Supported drivers are:
- To use streams you should install pg-query-stream package. P
- Transactions aren't supported by ${this.connection.driver.op
- SQLite only supports SERIALIZABLE and READ UNCOMMITTED isola
AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12).
Data as JSON: /api/errors/3deadf2ee2f4eafb.
Report an issue: GitHub.