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_attached

View on GitHub (pinned to 5ac6606e81)

Solutions

  1. Install sqlite3 in the runtime workspace: 'npm install sqlite3'.
  2. If on an unusual architecture, ensure a prebuilt binary exists or install build tools (python, make, g++) so node-gyp can compile.
  3. Pass options.driver = sqlite3 explicitly to bypass require if your bundling puts sqlite3 somewhere non-standard.
  4. 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

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


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