Closed anthony-bernardo closed 3 months ago
Can you import your controller like this, since this is also the recommended way in the AdonisJS docs.
const UsersController = () => import ('#controllers/UsersController')
@anthony-bernardo Did my previous reply solve your problem?
I always import my controller like this
const DashboardController = () => import('#controllers/v1/dashboard_controller')
but still getting
"ENOENT: no such file or directory, open 'file:///data/data/com.termux/files/home/js/adonis/boilerplate/config/swagger.ts/../app/controllers/v1/dashboard_controller.ts'"
package.json
"imports": {
"#controllers/*": "./app/http/controllers/*.js"
...
adonisrc.ts
export default defineConfig({
directories: {
httpControllers: 'app/http/controllers',
//...
"ENOENT: no such file or directory, open 'file:///data/data/com.termux/files/home/js/adonis/boilerplate/config/swagger.ts/../app/controllers/v1/dashboard_controller.ts'"
This line looks very strange to me: there shouldn't be a swagger.ts in the path. Would you mind sharing your swagger.ts
file, or comparing it to the docs and see whether you have misconfigured it?
Here is my swagger.ts
import path from "node:path";
import url from "node:url";
export default {
path: path.dirname(url.fileURLToPath(import.meta.url)) + "/../", // for AdonisJS v6
title: "Foo",
version: "1.0.0",
tagIndex: 2,
snakeCase: true,
ignore: ["/swagger", "/docs"],
preferredPutPatch: "PUT",
persistAuthorization: true,
showFullPath: false
};
"ENOENT: no such file or directory, open 'file:///data/data/com.termux/files/home/js/adonis/boilerplate/config/swagger.ts/../app/controllers/v1/dashboard_controller.ts'"
This line looks very strange to me: there shouldn't be a swagger.ts in the path. Would you mind sharing your
swagger.ts
file, or comparing it to the docs and see whether you have misconfigured it?
Yeah, I can reproduce. Moving the controllers to app/http/ and pointing them in package.json doesn't work. I'd have to parse the package.json for that.
I also have pointed that in adonisrc.ts under directories
Any update??
Any update??
Not yet, I need some time to fix it. PRs are always welcome, if you have the time.
Done in version 3.0
I installed the latest adonisJS version, but I got this error :
The issue is that my
UsersController.ts
is pathapp/controllers
and not inapp
pathHow to handle that ?