Ricky Barnett
Ricky Barnett

Reputation: 1170

AdonisJs Ace - E_IOC_LOOKUP_FAILED

I'm trying to load the Event system into an ace command.

public async run() {
    const { default: Event } = await import('@ioc:Adonis/Core/Event')
}

However this results in the following error: Cannot resolve "Adonis/Core/Event" namespace from the IoC Container

Based on the documentation I'm doing this right: https://docs.adonisjs.com/guides/ace-commandline#top-level-imports-are-not-allowed

Could anyone please advise?

Upvotes: 1

Views: 1705

Answers (3)

Saurabh Raj
Saurabh Raj

Reputation: 11

Generally, This kind of issue occurs because people forget to add providers in .adonisrc.json

So, Please add the following this might be different for others' case

"providers": [
   "./providers/AppProvider",
   "@adonisjs/core",
   "@adonisjs/lucid",
   "@adonisjs/auth"
]

Upvotes: 1

Dawar Farooq
Dawar Farooq

Reputation: 51

Set loadApp in your command settings property to true.

Then, run the command node ace generate:manifest.

Upvotes: 5

J T
J T

Reputation: 11

Try this commandit solve your issue.

node ace generate:manifest

Upvotes: 1

Related Questions