• Dev
  • Flarum Extension-Generator Setup Error

askvortsov I using now this code:

 "repositories": [
        {
            "type": "path",
            "url": "packages/*"
        }
]

What's the output of composer why-not superman/flarum-ext-batman

  • jedi replied to this.

    ..Says, "I not find"
    but how? I see name in the composer.json file

     [InvalidArgumentException]
      Could not find package "superman/flarum-ext-batman" in your project

      jedi Are you on discord? It might be faster to do a quick call with screenshare and get this figured out.

      My username is askvortsov#3485

        {
            "name": "superman/flarum-ext-batman",
            "description": "Being Hero",
            "keywords": [
                "flarum"

        askvortsov I'm Sorry, I don't use Discord. But thank a lot being helpfull me.

        I setup it's Flarum Extension-Generator again.
        Repositories is:

          "repositories": [
                {
                    "type": "path",
                    "url": "packages/batman"
                }
            ]

        askvortsov What's the output of composer why-not superman/flarum-ext-batman

        And now says, "There is no installed package depending on "superman/flarum-ext-batman"

        Are you sure guys, problem is repositories realy? Because I tried all way but error is the same.
        I read this article again, again and again: https://discuss.flarum.org/d/1608-extension-development-using-composer-repositories-path

           "repositories": [
                {
                    "type": "path",
                    "url": "C:/wamp64/www/bek/workbench/*"
                }
            ]

        Workbench folder is:

        composer.json file is:

        {
            "name": "superman/flarum-ext-batman",
            "description": "Being hero",
            "keywords": [
                "flarum"
            ],
            "type": "flarum-extension",
            "license": "MIT",
            "require": {
                "flarum/core": "^0.1.0-beta.8"
            },
            "authors": [
                {
                    "name": "Luke Skywalker",
                    "email": "skywalker_mark@gmail.com",
                    "role": "Developer"
                }
            ],
            "autoload": {
                "psr-4": {
                    "Superman\\Batman\\": "src/"
                }
            },
            "extra": {
                "flarum-extension": {
                    "title": "Hero Time",
                    "icon": {
                        "name": "fas fa-clock",
                        "backgroundColor": "#000",
                        "color": "#FFFFF"
                    }
                },
                "flagrow": {
                    "discuss": ""
                }
            },
            "repositories": [
                {
                    "type": "path",
                    "url": "C:/wamp64/www/bek/workbench/*"
                }
            ]
        }

          jedi You need to put the repositories key to the composer.json of the flarum install not in your extension. Make sure to use the packages/* again.

          "OMG! Luceos is here.." Error is solved.
          I got it now. I don't what to say, thank you so mach, man! Hell yeah! You are my hero. I'm feeling like won Eurovision Single Constent 2021. Thank you, thank you, thank you and thank you too Europe!

          But now I get this error when I start extension
          "File not found at path: C:\wamp64\www\bek\workbench\batman/js/dist/forum.js"
          I don't have a dist folder, how can I get (create) ?

          Myworkbench\batman\jsfolder is:

          src
          admin.js
          forum.js
          package.json
          webpack.config.js

            In workbench\batman\extend.php change the / to \ in the argument of ->js()

            DIRECTORY_SEPARATOR would be better but is a constant and cannot be added inside a string like that.

            Now batman\extend.php look like this:

            return [
                (new Extend\Frontend('forum'))
                    ->js(__DIR__.'\js\forum.js')
                    ->css(__DIR__.'/resources/less/forum.less'),
                (new Extend\Frontend('admin'))
                    ->js(__DIR__.'\js\admin.js')
                    ->css(__DIR__.'/resources/less/admin.less'),
                new Extend\Locales(__DIR__ . '/resources/locale')
            ];

            But now, site is not opening when I start extension

            .. removed because php interprets paths based on OS already.

            EDIT: all of this should not be necessary.

            AH. The js/dist/forum.js isn't available because you haven't compiled the javscript with npm yet. Reset your extend.php to the old version:

            return [
                (new Extend\Frontend('forum'))
                    ->js(__DIR__.'/js/forum.js')
                    ->css(__DIR__.'/resources/less/forum.less'),
                (new Extend\Frontend('admin'))
                    ->js(__DIR__.'/js/admin.js')
                    ->css(__DIR__.'/resources/less/admin.less'),
                new Extend\Locales(__DIR__ . '/resources/locale')
            ];

            And compile your javascript:

            cd js
            npm i
            npm run dev // or whatever command builds for development check the package.json

            Okay, First, I writed your DIRECTORY_SEPARATOR code, later I reseted my extend.php. (I removed DIRECTORY_SEPARATOR code) After that, I opened js folder in workbench/batman and I write npm i and npm run dev

            But is the same error contunie. Site is not opening, giving a error. I think this is my fault, I writed in wrong place npm i and npm run dev codes.

            By the way, thank you for helping me, you are the best.

            And yes, I think seriosly this. How can I use ubuntu for flarum extend? I'm searching now documenation for that.

            Error is:

            #45 C:\wamp64\www\bek\vendor\laminas\laminas-stratigility\src\Next.php(61): Middlewares\BasePathRouter->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
            #46 C:\wamp64\www\bek\vendor\laminas\laminas-stratigility\src\Middleware\OriginalMessages.php(42): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
            #47 C:\wamp64\www\bek\vendor\laminas\laminas-stratigility\src\Next.php(61): Laminas\Stratigility\Middleware\OriginalMessages->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
            #48 C:\wamp64\www\bek\vendor\middlewares\base-path\src\BasePath.php(53): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
            #49 C:\wamp64\www\bek\vendor\laminas\laminas-stratigility\src\Next.php(61): Middlewares\BasePath->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
            #50 C:\wamp64\www\bek\vendor\flarum\core\src\Http\Middleware\ProcessIp.php(24): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
            #51 C:\wamp64\www\bek\vendor\laminas\laminas-stratigility\src\Next.php(61): Flarum\Http\Middleware\ProcessIp->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
            #52 C:\wamp64\www\bek\vendor\laminas\laminas-stratigility\src\MiddlewarePipe.php(84): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
            #53 C:\wamp64\www\bek\vendor\laminas\laminas-stratigility\src\MiddlewarePipe.php(73): Laminas\Stratigility\MiddlewarePipe->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\EmptyPipelineHandler))
            #54 C:\wamp64\www\bek\vendor\laminas\laminas-httphandlerrunner\src\RequestHandlerRunner.php(96): Laminas\Stratigility\MiddlewarePipe->handle(Object(Laminas\Diactoros\ServerRequest))
            #55 C:\wamp64\www\bek\vendor\flarum\core\src\Http\Server.php(44): Laminas\HttpHandlerRunner\RequestHandlerRunner->run()
            #56 C:\wamp64\www\bek\public\index.php(26): Flarum\Http\Server->listen()

              jedi after running npm run dev, has this changed?

              jedi this is part of a stack trace of an error. If you look higher you should see the actual error message. Is it still the one about dist not being found?