Adonisjs last update (v5) model create command Not working

1.4k views Asked by At

Adonisjs v5

Create a controller command work fine.

node ace make:controller Posts

But Create a new model Command not working

node ace:make model Post

Run the make model command show error

Cannot find module 'C:\Users\abir2\Desktop\crm-backend\ace:make'

adonisjs v5 How to create a model using command?

3

There are 3 answers

0
Vinicius Cainelli On

Try this one:

node ace make:model Posts

You can check the help directly on the cmd

node ace make --help
0
Brian Kemboi On

Assuming you already have lucid setup

Generate ace commands manifest file

node ace generate:manifest

Check if the command was generated

node ace make --help

Retry the model command

node ace make:model Post
0
Edriss Aria On

According to adonisjs documentation: Assuming you already have lucid set up, run the following command to create your first data model

node ace make:model User

let's set up the lucid:

run npm i @adonisjs/lucid then configure it by runing

node ace configure @adonisjs/lucid

finally run above ace command to create model