You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Previously, pg would be required by this file, but now that the import name is dynamic, the bundler does not know what to include so the pg package is missing in the compiled file, prompting error:
"Postgres package has not been found installed. Please run "npm install pg"."
Tried manually importing pg using import 'pg'; but to no avail.
Does these recent changes mean that webpack is no longer supported by typeorm?
Actual Behavior
Error on runtime
Postgres package has not been found installed. Please run "npm install pg".
Steps to reproduce
Install typeom + pg
Build using webpack, here is a sample config
DriverPackageNotInstalledError: Postgres package has not been found installed. Please run "npm install pg".
at PostgresDriver.loadDependencies (/Users/submarines/Downloads/MyProject/src/driver/postgres/PostgresDriver.ts:1719:19)
at new PostgresDriver (/Users/submarines/Downloads/MyProject/src/driver/postgres/PostgresDriver.ts:370:14)
at DriverFactory.create (/Users/submarines/Downloads/MyProject/src/driver/DriverFactory.ts:62:24)
at new DataSource (/Users/submarines/Downloads/MyProject/src/data-source/DataSource.ts:142:43)
at Object. (/Users/submarines/Downloads/MyProject/src/data-source.ts:5:30)
at Module._compile (node:internal/modules/cjs/loader:1781:14)
at Module.m._compile (/Users/submarines/Downloads/MyProject/node_modules/ts-node/src/index.ts:1618:23)
at node:internal/modules/cjs/loader:1913:10
at Object.require.extensions. [as .ts] (/Users/submarines/Downloads/MyProject/node_modules/ts-node/src/index.ts:1621:12)
at Module.load (node:internal/modules/cjs/loader:1505:32)
Activity
submarines-and commentedon Jul 20, 2026
Actually, I think it may have broken for all build types. If I do a completely fresh project using:
npx typeorm init --name MyProject --database postgres
and then yarn &6 yarn start
It breaks with the same error
DriverPackageNotInstalledError: Postgres package has not been found installed. Please run "npm install pg".
at PostgresDriver.loadDependencies (/Users/submarines/Downloads/MyProject/src/driver/postgres/PostgresDriver.ts:1719:19)
at new PostgresDriver (/Users/submarines/Downloads/MyProject/src/driver/postgres/PostgresDriver.ts:370:14)
at DriverFactory.create (/Users/submarines/Downloads/MyProject/src/driver/DriverFactory.ts:62:24)
at new DataSource (/Users/submarines/Downloads/MyProject/src/data-source/DataSource.ts:142:43)
at Object. (/Users/submarines/Downloads/MyProject/src/data-source.ts:5:30)
at Module._compile (node:internal/modules/cjs/loader:1781:14)
at Module.m._compile (/Users/submarines/Downloads/MyProject/node_modules/ts-node/src/index.ts:1618:23)
at node:internal/modules/cjs/loader:1913:10
at Object.require.extensions. [as .ts] (/Users/submarines/Downloads/MyProject/node_modules/ts-node/src/index.ts:1621:12)
at Module.load (node:internal/modules/cjs/loader:1505:32)
[-]Webpack bundles (pg) broken in 1.1[/-][+]Pg not found using v1.1[/+]test: add unit tests for PlatformTools.load() static require switch
[-]Pg not found using v1.1[/-][+]webpack bundling broken in v1.1[/+]alumni commentedon Jul 22, 2026
I was expecting that
import 'pg'would work - I was forced to do something similar withwebpackandpnpmeven before this change.Do you happen to have some small repo with a reproduction example?
OchirDarmaev commentedon Jul 23, 2026
faced the same issue with
esbuilderror
DriverPackageNotInstalledError2: Postgres package has not been found installed. Please run "npm install pg".Deps
Solution: typeorm >=1.1 loads drivers via a dynamic require that esbuild cannot bundle — pass pg explicitly
Mause commentedon Oct 25, 2026
I'm seeing the same issue with vite + react-router as well - #12729 fixes it for that combination too
fix: use static require() calls in PlatformTools.load() for bundler c…
test: add unit tests for PlatformTools.load() static require switch