Lucidprovider cannot be found


#1

Hi all,

I’m new with AdonisJs and was trying to make a post request to my model to insert data to.
I need to install sqlite for that but i cannot seem to get there because it cannot find the lucid provider to install it.

My App.js looks like this

const providers = [
  '@adonisjs/framework/providers/AppProvider',
  '@adonisjs/auth/providers/AuthProvider',
  '@adonisjs/bodyparser/providers/BodyParserProvider',
  '@adonisjs/cors/providers/CorsProvider',
  '@adonisjs/lucid/providers/LucidProvider'
]

and

const aceProviders = [
  '@adonisjs/lucid/providers/MigrationsProvider'
]

In my route.js i specify that its a post request

Route.group(() => {
  Route.post('auth/register', 'UserController.register')
}).prefix('api/v1')

And the userController looks like this

'use strict'

const User = use('App/Models/User')

class UserController {
    async register({ request }){
        const { email, password} = request.all()
        const user = await User.create({
            email,
            password,
            username: email,
        });
        return user;
    }
}

export default UserController

Its kinda weird to see that the LucidProvider is defined in the app.js but the module cannot be found.

Error: Cannot find module ‘@adonisjs/lucid/providers/LucidProvider’

Does anyone know how to get sqlite through so I can run my migration to insert the json data from my server into my model ?


#2

Hello, try to install adonis-lucid with command:

adonis install @adonisjs/lucid

https://github.com/adonisjs/adonis-lucid#readme


#3

Hey ,

Thanks its solved, not by using the command lucid but with

npm install sqlite3

Because it was already written in app.js

Thanks,

Love this framework though, looks like laravel and is completer than express.