drizzle-team / drizzle-team/drizzle-orm

[BUG]: Drizzle Kit doesn't work if node_modules contains symlinks outside of project

Open
#6,156 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
TypeScript
Stars
35.8k
Forks
1.6k
Avg merge
2d 7h
Merged PRs (30d)
4

Description

### Report hasn't been filed before.

- [x] I have verified that the bug I'm about to report hasn't been filed before.

### What version of `drizzle-orm` are you using?

0.45.2

### What version of `drizzle-kit` are you using?

0.31.10

### Other packages

_No response_

### Describe the Bug

If `node_modules` contains symlinks to a location outside the project, Drizzle-Kit fails with this error:
> Please install latest version of drizzle-orm

This happens when using `nub` by default or `pnpm` with `enableGlobalVirtualStore: true`.

It seems to be ESM dynamic `import()` not honoring `NODE_PATH`.

https://github.com/drizzle-team/drizzle-orm/blob/4aa6ecfee4b4728dadf6f77f071a149878a3c6c0/drizzle-kit/src/cli/utils.ts#L78-L101

It's the same mechanism in v1.0.0-rc versions.

Contributor guide

Open the contributing guide

Research direction

Start in drizzle-kit/src/cli/utils.ts around lines 78-101 and inspect how the CLI loads drizzle-orm. Reproduce the failure with node_modules symlinked outside the project using nub or pnpm with enableGlobalVirtualStore: true; done means Drizzle Kit no longer reports that the latest drizzle-orm must be installed in that setup.

Written by the indexing model from the issue text.

Assessment

Tech stack
nodejs, typescript
Domain
cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.