katotopark
katotopark

Reputation: 25

adonisjs lucid module not found

I used adonis make:model Thing --migration to create and migrate. Therefore i have 'Thing.js file in my models with the following code in it:

'use strict'

const Model = use('Model')

class Thing extends Model {
}

module.exports = Thing

I then replaced 'Model' with 'Lucid' since I'd like to structure a relational database. But this is the error I get on my terminal when I run server.js: "Cannot find module 'Lucid'".

and this is how it looks inside the start/app.js file:

const providers = [
  '@adonisjs/framework/providers/AppProvider',
  '@adonisjs/framework/providers/ViewProvider',
  '@adonisjs/lucid/providers/LucidProvider',
  '@adonisjs/bodyparser/providers/BodyParserProvider',
  '@adonisjs/cors/providers/CorsProvider',
  '@adonisjs/shield/providers/ShieldProvider',
  '@adonisjs/session/providers/SessionProvider',
  '@adonisjs/auth/providers/AuthProvider',
  '@adonisjs/validator/providers/ValidatorProvider'
] 

and at the end:

module.exports = { providers, aceProviders, aliases, commands }

What is the reason for this? How do I fix it?

ps: the project was initialized the typical way thus the folder structure is as is: adonis new myprojectsname

Upvotes: 0

Views: 3570

Answers (1)

Romain Lanz
Romain Lanz

Reputation: 885

use('Model') will use the Model class of Lucid provider. You don't need to change it to create a relational database.

Upvotes: 1

Related Questions