TypeError: Cannot read properties of undefined (reading 'booted') #4675
Replies: 5 comments
-
|
Hey @equeraltovivas! 👋🏻 You need to ensure you are using exactly the same version of Lucid between your application and your model. |
Beta Was this translation helpful? Give feedback.
-
|
Hi @RomainLanz , |
Beta Was this translation helpful? Give feedback.
-
|
I think the problem is that Lucid's BaseModel has adapter to database as a singleton property. This causes that when we move models to a shared folder between several projects it does not have adapter and it fails. How can we keep models in a shared folder between Adonis projects? |
Beta Was this translation helpful? Give feedback.
-
|
Hey @equeraltovivas have you solved it? I'm having the exact same problem I'm using turborepo with pnpm, and I created a db package to share my models between my 2 projects |
Beta Was this translation helpful? Give feedback.
-
|
To anyone that comes here in the future. Make sure you have the same adonisjs related dependencies across all your apps. After some time debugging, PNPM joins dependencies based on their versions So like, if one app has adonis [email protected] and ts at @5.2, and another app has the same version of adonis core, but ts is idk, 5.5, it will bundle 2 adonis core What I did to fix was I created a pnpm catalog with all adonisjs related dependencies. This is my catalog, I hope is helps catalogs: |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
When I move the models to a local library, I get the following error when trying to use it for the Auth Guard.
Project estructure:
app1 package.json:
Beta Was this translation helpful? Give feedback.
All reactions