Reputation: 1170
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
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
Reputation: 51
Set loadApp
in your command settings property to true
.
Then, run the command node ace generate:manifest
.
Upvotes: 5