kerwanp / adonis-cockpit

The ultimate Admin Panel Builder for AdonisJS
https://adonis-cockpit.com
MIT License
48 stars 3 forks source link

Am I doing something wrong? || Setup Doesn't work #23

Open mattstrayer opened 1 month ago

mattstrayer commented 1 month ago

Here's a minimal reproduction repo -> https://github.com/mattstrayer/cockpit-repro

this is the text I get when trying to load the root directory or the admin directory

{
    "message": "Cannot resolve binding \"vite\" from the container",
    "name": "RuntimeException",
    "status": 500,
    "frames": [{
        "file": "node_modules/@adonisjs/fold/src/resolver.ts",
        "filePath": "/Users/matt/dev/cockpit/node_modules/@adonisjs/fold/src/resolver.ts",
        "line": 246,
        "callee": "createError",
        "calleeShort": "createError",
        "column": 46,
        "context": {},
        "isModule": true,
        "isNative": false,
        "isApp": false
    }, {
        "file": "node_modules/@adonisjs/fold/src/resolver.ts",
        "filePath": "/Users/matt/dev/cockpit/node_modules/@adonisjs/fold/src/resolver.ts",
        "line": 404,
        "callee": "resolveFor",
        "calleeShort": "resolveFor",
        "column": 11,
        "context": {},
        "isModule": true,
        "isNative": false,
        "isApp": false
    }, {
        "file": "node_modules/@adonisjs/fold/src/resolver.ts",
        "filePath": "/Users/matt/dev/cockpit/node_modules/@adonisjs/fold/src/resolver.ts",
        "line": 443,
        "callee": "make",
        "calleeShort": "make",
        "column": 17,
        "context": {},
        "isModule": true,
        "isNative": false,
        "isApp": false
    }, {
        "file": "node_modules/@adonisjs/fold/src/container.ts",
        "filePath": "/Users/matt/dev/cockpit/node_modules/@adonisjs/fold/src/container.ts",
        "line": 191,
        "callee": "make",
        "calleeShort": "make",
        "column": 34,
        "context": {},
        "isModule": true,
        "isNative": false,
        "isApp": false
    }, {
        "file": "Users/matt/dev/cockpit/node_modules/@adonisjs/inertia/build/providers/inertia_provider.js",
        "filePath": "/Users/matt/dev/cockpit/node_modules/@adonisjs/inertia/build/providers/inertia_provider.js",
        "line": 29,
        "callee": "",
        "calleeShort": "",
        "column": 45,
        "context": {
            "start": 24,
            "pre": "   */\n  async register() {\n    this.app.container.singleton(InertiaMiddleware, async () => {\n      const inertiaConfigProvider = this.app.config.get(\"inertia\");\n      const config = await configProvider.resolve(this.app, inertiaConfigProvider);",
            "line": "      const vite = await this.app.container.make(\"vite\");",
            "post": "      if (!config) {\n        throw new RuntimeException(\n          'Invalid \"config/inertia.ts\" file. Make sure you are using the \"defineConfig\" method'\n        );\n      }"
        },
        "isModule": false,
        "isNative": false,
        "isApp": false
    }]
}

I setup a new project with adonis 6 and used the api template.

I then setup copilot from the node ace add xxxx command for cockpit

kerwanp commented 1 month ago

Hi! This issue is "kind of" tracked here https://github.com/kerwanp/adonis-cockpit/issues/9 Basically Cockpit configure for you @adonisjs/inertia for you but it currently does not configure @adonisjs/vite so you have to do it youself: https://docs.adonisjs.com/guides/basics/vite#vite