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

SqliteLibrary.loadLibrary() tries to resolve the native `sqlite3` package via require(); if that throws (module not found or failed to load native bindings) it rethrows as DriverPackageNotInstalledError('SQLite','sqlite3'). The DataSource cannot open any connection until this succeeds, so this fails at boot.

Source

Thrown at packages/@n8n/typeorm/src/driver/sqlite-pooled/SqliteLibrary.ts:42

	 */
	public sqlite: sqlite3;

	/**
	 * Any attached databases (excepting default 'main')
	 */
	public attachedDatabases: DatabasesMap = new Map();

	constructor(private readonly options: SqlitePooledConnectionOptions) {}

	/**
	 * If driver dependency is not given explicitly, then try to load it via "require".
	 */
	public loadLibrary(): void {
		try {
			const sqlite = this.options.driver || require('sqlite3');
			this.sqlite = sqlite.verbose();
		} catch (e) {
			throw new DriverPackageNotInstalledError('SQLite', 'sqlite3');
		}
	}

	/**
	 * Creates connection with the database.
	 *
	 * @param {number} flags Flags, such as SQLITE_OPEN_READONLY, to pass to the sqlite3 database connection
	 */
	public async createDatabaseConnection(flags?: number): Promise<Sqlite3Database> {
		if (this.options.flags === undefined || !(this.options.flags & this.sqlite.OPEN_URI)) {
			await this.createDatabaseDirectory(this.options.database);
		}

		const databaseConnection: Sqlite3Database = await new Promise((ok, fail) => {
			if (this.options.flags === undefined && flags === undefined) {
				const connection = new this.sqlite.Database(this.options.database, (err: any) => {
					if (err) return fail(err);
					ok(connection);

View on GitHub (pinned to 5ac6606e81)

Solutions

  1. Install the dependency: `pnpm add sqlite3` (or the workspace-appropriate install command).
  2. Re-run a clean install: remove node_modules and lockfile-state, then `pnpm install`.
  3. Ensure the Node version matches a sqlite3 release with prebuilt binaries, or install the build toolchain (python, make, C++ compiler) so the native addon can compile.
  4. If passing a custom driver via options.driver, make sure that object is a working sqlite3 module.

Example fix

// before — sqlite3 missing from node_modules
const ds = new DataSource({ type: 'sqlite', database: './db.sqlite' });
await ds.initialize(); // throws DriverPackageNotInstalledError

// after
// $ pnpm add sqlite3
const ds = new DataSource({ type: 'sqlite', database: './db.sqlite' });
await ds.initialize();
Defensive patterns

Strategy: validation

Validate before calling

function sqlite3Available(): boolean {
  try {
    require.resolve('sqlite3');
    return true;
  } catch {
    return false;
  }
}

if (!sqlite3Available()) {
  throw new Error('sqlite3 is not installed. Run: pnpm add sqlite3');
}
await dataSource.initialize();

Type guard

import { DriverPackageNotInstalledError } from '@n8n/typeorm';

function isDriverPackageNotInstalledError(e: unknown): e is DriverPackageNotInstalledError {
  return e instanceof DriverPackageNotInstalledError;
}

Try / catch

try {
  await dataSource.initialize();
} catch (e) {
  if (e instanceof DriverPackageNotInstalledError) {
    console.error(`Missing native driver. Install it: ${e.message}`);
  }
  throw e;
}

Prevention

When it happens

Trigger: Constructing/initializing a SQLite DataSource when the `sqlite3` npm package is not installed, is not resolvable from the running module's node_modules, or its native binding failed to compile/load for the current Node/ABI/arch.

Common situations: Missing dependency after a fresh clone, a botched `pnpm install`, Node version upgrade breaking the prebuilt sqlite3 binary, missing build toolchain forcing a failed source build, or a bundler/frozen-lockfile install that skipped optional native deps.

Related errors


AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12). Data as JSON: /api/errors/603d3949cc08bc33. Report an issue: GitHub.