zenstack: Generated "enhance" function not found. Please run zenstack generate first.
Description and expected behavior
I started the development of a Nuxt application and after defining my zenstack schema, I wrote an API route for the server to retrieve a file entity from the database. But I get an error after having at the execution level of enhance(prisma). However I have already run npx zenstack generate and npx prisma db push.
Screenshots zmodel
global prisma client
route api
Environment (please complete the following information):
- ZenStack version: 2.11.5
- Prisma version: 6.3.x
- Database type: Postgresql
Additional context I running nuxt with compatibility version 4
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 1
- Comments: 22 (13 by maintainers)
I made a few tries with node 20.19.0 as @sslotnick indicated:
tsxran into the issue, @sslotnick 's workaround worked for mets-nodeworked fine, compiling withtscand then running directly withnodeworked fineSo it seems later node versions broke something related loading ESM with
require, however the issue only happens with certain bundler (nuxt) and nodejs loaders (tsx) …I don’t have further insight into the issue so far, and please use @sslotnick 's workaround for now.
I just encountered this issue going from node 20.18.3 to 20.19.0. Using the flag
--no-experimental-require-modulefixes it.