Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Entity types cannot be resolved in PNPM monorepo #7484

Closed
Yaojian opened this issue Jun 6, 2021 · 2 comments · Fixed by #7942
Closed

Entity types cannot be resolved in PNPM monorepo #7484

Yaojian opened this issue Jun 6, 2021 · 2 comments · Fixed by #7942
Assignees
Labels
bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. kind/bug A reported bug. team/client Issue for team Client. topic: monorepo topic: pnpm
Milestone

Comments

@Yaojian
Copy link

Yaojian commented Jun 6, 2021

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                                                                               
@Yaojian Yaojian added the kind/bug A reported bug. label Jun 6, 2021
@janpio janpio added bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. team/client Issue for team Client. topic: monorepo topic: pnpm labels Jun 6, 2021
@PabloSzx
Copy link

@Yaojian could you confirm this issue is fixed using these versions of prisma?

I personally tested in a couple projects and everything seems to work correctly now

"prisma": "2.27.0-integration-fix-sdk-pnpm.1",
"@prisma/client": "2.27.0-integration-fix-sdk-pnpm.1",

@Yaojian
Copy link
Author

Yaojian commented Jun 30, 2021

It works 😄 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. kind/bug A reported bug. team/client Issue for team Client. topic: monorepo topic: pnpm
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants