1

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?

Ricky Barnett
  • 1,130
  • 3
  • 15
  • 32

3 Answers3

4

Set loadApp in your command settings property to true.

Then, run the command node ace generate:manifest.

csgeek
  • 711
  • 6
  • 15
1

Try this commandit solve your issue.

node ace generate:manifest
J T
  • 11
  • 1
0

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"
]