The LaunchQL monorepo experiences "duplicate GraphQL modules" errors due to conflicting GraphQL version requirements across the dependency tree, despite having GraphQL resolutions in place.
PostGraphile 4.14.1 accepts an extremely broad GraphQL version range:
"^0.6.0 || ^0.7.0 || ^0.8.0-b || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.2 || ^15.0.0"
The npm dependency tree shows conflicts with our GraphQL 15.5.2 resolution:
npm ls graphql --allConflicting packages:
graphql-upload@15.0.2expects^16.3.0@pyramation/postgisexpects>=0.6 <15- Current resolution:
15.5.2(conflicts with both)
graphql@15.5.2 deduped invalid: "^16.3.0" from node_modules/graphql-upload, ">=0.6 <15" from node_modules/@pyramation/postgis
The following packages now have GraphQL resolutions set to 15.5.2:
- Root workspace (
package.json) @launchql/cli@launchql/server@launchql/explorer@launchql/query@launchql/graphile-query@launchql/graphile-testgraphile-settings✅ (recently added)@launchql/types✅ (recently added)
pnpm's overrides field does not always override peer dependency requirements. When packages have conflicting peer dependency ranges, Node.js can still load multiple versions of GraphQL, causing the "duplicate modules" error.
graphql-upload@15.0.2(current): requires^16.3.0❌graphql-upload@14.0.0: requires^16.3.0❌graphql-upload@13.0.0: supports0.13.1 - 16✅ (compatible with 15.5.2)graphql-upload@11.0.0: supports0.13.1 - 15✅ (compatible with 15.5.2)
@pyramation/postgis@0.1.1(only version): requires>=0.6 <15❌ (incompatible with 15.5.2)
- Downgrade graphql-upload: From
15.0.2to13.0.0(supports GraphQL 15.5.2) - Handle @pyramation/postgis: Add to overrides or find alternative package
- Add overrides field: Stronger enforcement than resolutions
- Clean install: Remove node_modules and pnpm-lock.yaml, then reinstall with
pnpm install
- Upgrade to GraphQL 16.x to satisfy
graphql-upload - Verify PostGraphile 4.14.1 compatibility with GraphQL 16.x
- Update all packages to support GraphQL 16.x
- Replace
graphql-uploadwith a compatible alternative - Replace
@pyramation/postgisif no compatible version exists
- ✅ Document GraphQL dependency conflicts (this file)
- 🔄 Downgrade graphql-upload from 15.0.2 to 13.0.0
- ⏳ Add overrides field to root package.json
- ⏳ Handle @pyramation/postgis incompatibility
- ⏳ Clean install and verify no conflicts remain
- ⏳ Test
lql servercommand to ensure error is resolved
# Check current GraphQL versions
npm ls graphql --all
# Check package version compatibility
npm view graphql-upload@13.0.0 peerDependencies.graphql
npm view @pyramation/postgis@latest peerDependencies.graphql
# Check PostGraphile dependency range
npm view postgraphile@4.14.1 dependencies.graphqlEnsure that there is only one instance of "graphql" in the node_modules
directory. If different versions of "graphql" are the dependencies of other
relied on modules, use "resolutions" to ensure only one version is installed.
Duplicate "graphql" modules cannot be used at the same time since different
versions may have different capabilities and behavior.