Can't install plugin

Summary

I can’t install plugins either by the command line, or by using the admin area UI. I’ll go through both scenarios.

 

Scenario 1: Steps to reproduce (command line install)

Install Shopware 6 using docker. Create composer.json and BundleExample.php according to this guide: https://docs.shopware.com/en/shopware-platform-dev-en/getting-started/indepth-guide-bundle/setup

Atempt to install using this line:

bin/console plugin:install --activate BundleExample

 

Current behaviour

After running the install command, this error is shown in the console:

Shopware Plugin Lifecycle Service

Install 1 plugin(s):

  • Example for Shopware (v1.0.0)

In PluginLifecycleService.php line 405:

Call to a member function setContainer() on null

 

Scenario 2: Steps to reproduce (admin area UI)

Install Shopware 6 using docker. Create composer.json and BundleExample.php according to this guide: https://docs.shopware.com/en/shopware-platform-dev-en/getting-started/indepth-guide-bundle/setup

Run this line so that the plugin is visible in the admin area:

bin/console plugin:refresh

Go to the admin area then Settings > System > Plugins. (at this point a console error appears - see logs below)

Click “Install” next to the Example for Shopware plugin.

 

Current behaviour

After clicking “Install”, an infinite loading spinner appears. The plugin doesn’t get installed.

 

Relevant logs

On navigating to Settings > System > Plugins, I see the following error in the console:

POST http://localhost:8000/api/v1/_action/store/checklogin?language=en-GB 500 (Internal Server Error)

Here is the response.

{
    "errors": [{
        "status": "500",
        "code": "FRAMEWORK__STORE_TOKEN_IS_MISSING",
        "title": "Internal Server Error",
        "detail": "Store host is missing",
        "meta": {
            "parameters": []
        },
        "trace": [{
            "file": "\/app\/vendor\/symfony\/http-kernel\/HttpKernel.php",
            "line": 151,
            "function": "checkLogin",
            "class": "Shopware\\Core\\Framework\\Store\\Api\\StoreController",
            "type": "-\u003E",
            "args": [{
                "languageIdChain": ["2fbb5fe2e29a4d70aa5854ce7ce3e20b"],
                "versionId": "0fa91ce3e96a4bc2be4bd9ce752c3425",
                "currencyId": "b7d2554b0ce847cd82f3ac9bd1c0dfca",
                "currencyFactor": 1,
                "currencyPrecision": 2,
                "scope": "user",
                "ruleIds": [],
                "source": {},
                "considerInheritance": false,
                "taxState": "gross",
                "extensions": []
            }]
        }, {
            "file": "\/app\/vendor\/symfony\/http-kernel\/HttpKernel.php",
            "line": 68,
            "function": "handleRaw",
            "class": "Symfony\\Component\\HttpKernel\\HttpKernel",
            "type": "-\u003E",
            "args": [{
                "attributes": {},
                "request": {},
                "query": {},
                "server": {},
                "files": {},
                "cookies": {},
                "headers": {}
            }, 1]
        }, {
            "file": "\/app\/vendor\/symfony\/http-kernel\/Kernel.php",
            "line": 198,
            "function": "handle",
            "class": "Symfony\\Component\\HttpKernel\\HttpKernel",
            "type": "-\u003E",
            "args": [{
                "attributes": {},
                "request": {},
                "query": {},
                "server": {},
                "files": {},
                "cookies": {},
                "headers": {}
            }, 1, true]
        }, {
            "file": "\/app\/public\/index.php",
            "line": 54,
            "function": "handle",
            "class": "Symfony\\Component\\HttpKernel\\Kernel",
            "type": "-\u003E",
            "args": [{
                "attributes": {},
                "request": {},
                "query": {},
                "server": {},
                "files": {},
                "cookies": {},
                "headers": {}
            }]
        }]
    }]
}

I’m not sure if this is relevant, but I get a similar response from http://localhost:8000/api/v1/_action/store/licenses?language=en-GB when I navigate to Settings > System > Plugins > Licenses.

Hello @Rearden‍,

this error also occurs if you misconfigured your composer.json file.
Please double check if the properties extra.shopware-plugin-class , as well as the  autoload.psr-4  object is configured properly and contains correct namespace- and class-names.

Kind regards,
Patrick  Shopware

1 „Gefällt mir“

Hi @Patrick‍

My composer file was correct since I had copied it straight from the tutorial. After looking at the documentation again I realized I had made a silly mistake - my BundleExample.php file was not in the right location.