[BUG]: drizzle-kit@1.0.0-beta.20 missing drizzle-orm peerDependency causes 'Cannot find module' in npm workspaces

Open Beginner friendly
#5,573 4 comments 8 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
node.js, typescript
Domain
tooling

Research direction

Start by checking the drizzle-kit package manifest and the generated bin.cjs entry point, especially the external drizzle-orm requires on lines 59-67. Reproduce the install in an npm workspace with the conflicting peer dependency, then verify that the published package declares the runtime requirement and that drizzle-kit generate no longer reports the missing module.

Written by the indexing model from the issue text.

Description

Report hasn't been filed before.
  • I have verified that the bug I'm about to report hasn't been filed before.
What version of drizzle-orm are you using?

1.0.0-beta.20

What version of drizzle-kit are you using?

1.0.0-beta.20

Other packages

npm 11.6.2, Node.js 24.13.0

Describe the Bug

drizzle-kit@1.0.0-beta.20's bin.cjs does external require('drizzle-orm/...') calls (line 59-67), but drizzle-orm is not declared as a peerDependency or dependency in the published package.

In the source repo, drizzle-orm is listed as a devDependency with workspace:./drizzle-orm/dist. This workspace: path reference is published as-is to npm (pnpm does not transform workspace:./path syntax during publish, only workspace:* / workspace:^).

Published drizzle-kit@1.0.0-beta.20 on npm:

{
  "dependencies": {
    "@drizzle-team/brocli": "^0.11.0",
    "@js-temporal/polyfill": "^0.5.1",
    "esbuild": "^0.25.10",
    "get-tsconfig": "^4.13.6",
    "jiti": "^2.6.1"
  },
  "devDependencies": {
    "drizzle-kit": "^0.31.6",
    "drizzle-orm": "workspace:./drizzle-orm/dist"
  }
}

Note: drizzle-orm is completely absent from dependencies and peerDependencies.

bin.cjs requires drizzle-orm externally:

// bin.cjs lines 59-67
let drizzle_orm__relations = require("drizzle-orm/_relations");
let drizzle_orm = require("drizzle-orm");
let drizzle_orm_pg_core = require("drizzle-orm/pg-core");
let drizzle_orm_casing = require("drizzle-orm/casing");
// ... etc

This works by accident in flat node_modules layouts where drizzle-orm happens to be hoisted to the root. But it breaks in npm workspaces when another package has a conflicting peer dependency on drizzle-orm (e.g., fraci@0.18.0 requires drizzle-orm >= 0.30.0 < 0.45.0), preventing npm from hoisting drizzle-orm@1.0.0-beta.20 to the root node_modules/.

In this case drizzle-kit is hoisted to root node_modules/drizzle-kit/, but drizzle-orm only exists in each workspace's node_modules/, so require('drizzle-orm/_relations') fails.

Expected behavior

drizzle-kit should declare drizzle-orm as a peerDependency in package.json:

{
  "peerDependencies": {
    "drizzle-orm": ">=1.0.0-beta.1"
  }
}

This would tell npm that drizzle-kit needs drizzle-orm available at runtime and ensure proper resolution in monorepo/workspace setups.

Environment & setup
  • OS: macOS (Darwin 25.4.0)
  • Package manager: npm 11.6.2
  • Monorepo: npm workspaces
  • Node.js: 24.13.0
Reproduction
  1. Create an npm workspace monorepo
  2. Add drizzle-orm@1.0.0-beta.20 and drizzle-kit@1.0.0-beta.20 to a workspace package
  3. Add another dependency that has a conflicting peer dep on drizzle-orm (e.g., fraci@0.18.0 which requires drizzle-orm < 0.45.0)
  4. Run npm install
  5. Run drizzle-kit generate
Error: Cannot find module 'drizzle-orm/_relations'
Require stack:
- /path/to/node_modules/drizzle-kit/bin.cjs
Workaround

Add drizzle-orm to the root package.json dependencies and use --legacy-peer-deps to force hoisting despite the peer dep conflict.

Dominant language
TypeScript
Stars
35.8k
Forks
1.6k
Avg merge
1d 13h
Merged PRs (30d)
4

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from drizzle-team/drizzle-orm

All issues in drizzle-team/drizzle-orm

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.