Skip to content

Entity types cannot be resolved in PNPM monorepo #7484

@Yaojian

Description

@Yaojian

Bug description

In a monorepo with PNPM workspace, @prisma/client is resolved to the <monorepo_rootdir>/node_modules rather than the node_modules under the project which depends on Prisma directly.

For example:

  • * packages * webclient * server (which has the dependency on `@prisma/client`)

@prisma/client is resolved to ProjectRoot/node_modules rather than packages/server/node_modules, which causes entity types cannot be resolved:

$ pnpx tsc
src/script.ts:1:24 - error TS2305: Module '"../node_modules/@prisma/client"' has no exported member 'User'.

1 import { PrismaClient, User } from '@prisma/client'
                         ~~~~

How to reproduce

I setup a tiny monorepo https://github.com/Yaojian/prisma-monorepo .

Expected behavior

No response

Prisma information

see the github source

Environment & setup

  • OS: Windows
  • Database: Sqlite
  • Node.js version: 14.15.5

Prisma Version

prisma               : 2.24.1                                                                                
@prisma/client       : 2.24.1                                                                                
Current platform     : windows                                                                               
Query Engine         : query-engine 18095475d5ee64536e2f93995e48ad800737a9e4 (at ..\..\node_modules\.pnpm\reg
istry.nlark.com+@prisma+engines@2.24.1-2.18095475d5ee64536e2f93995e48ad800737a9e4\node_modules\@prisma\engine
s\query-engine-windows.exe)                                                                                  
Migration Engine     : migration-engine-cli 18095475d5ee64536e2f93995e48ad800737a9e4 (at ..\..\node_modules\.
pnpm\registry.nlark.com+@prisma+engines@2.24.1-2.18095475d5ee64536e2f93995e48ad800737a9e4\node_modules\@prism
a\engines\migration-engine-windows.exe)                                                                      
Introspection Engine : introspection-core 18095475d5ee64536e2f93995e48ad800737a9e4 (at ..\..\node_modules\.pn
pm\registry.nlark.com+@prisma+engines@2.24.1-2.18095475d5ee64536e2f93995e48ad800737a9e4\node_modules\@prisma\
engines\introspection-engine-windows.exe)                                                                    
Format Binary        : prisma-fmt 18095475d5ee64536e2f93995e48ad800737a9e4 (at ..\..\node_modules\.pnpm\regis
try.nlark.com+@prisma+engines@2.24.1-2.18095475d5ee64536e2f93995e48ad800737a9e4\node_modules\@prisma\engines\
prisma-fmt-windows.exe)                                                                                      
Default Engines Hash : 18095475d5ee64536e2f93995e48ad800737a9e4                                              
Studio               : 0.397.0                                                                               

Metadata

Metadata

Assignees

Labels

bug/1-unconfirmedBug should have enough information for reproduction, but confirmation has not happened yet.kind/bugA reported bug.topic: monorepotopic: pnpm

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions