xenomedia / xeno_hero

Drupal 8 module that creates a Hero Paragraphs bundle.
GNU General Public License v2.0
23 stars 18 forks source link

Installing with Composer #20

Open tkcent opened 5 years ago

tkcent commented 5 years ago

Just thought I would leave a note here in case anyone was wanting to install with Composer. Not sure if this is the official way to do it, but it worked for me.

1) Update your project composer.json file with the xeno_hero repository:

    "repositories": [
        {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        },
        {
            "type": "git",
            "url": "https://github.com/xenomedia/xeno_hero.git"
        }
    ],

2) Update your project composer.json file so it knows where to install the modules with the type of "drupal-custom-module". This is what is configured in the xeno_hero composer.json file. I put it in contrib with other modules but you could also put it in a custom directory.

        "installer-paths": {
            "web/modules/contrib/{$name}": ["type:drupal-module","type:drupal-custom-module"],
        },

3) Update Composer so it knows about the new repository.

composer update

4) Add the module using Composer

composer require xenomedia/xeno_hero
jsibley2 commented 3 years ago

After installing the module this way, how does one uninstall it in Drupal 8.

Composer remove doesn't give an error, but after that drush cr gives me this:

Fatal error: Uncaught AssertionError: The file specified by the given app root, relative path and file name (/app/docroot/modules/custom/xeno_hero/xeno_hero.info.yml) do not exist. in /app/docroot/core/lib/Drupal/Core/Extension/Extension.php:67
Stack trace:
#0 /app/docroot/core/lib/Drupal/Core/Extension/Extension.php(67): assert(false, 'The file specif...')
#1 /app/docroot/core/lib/Drupal/Core/Extension/ModuleHandler.php(114): Drupal\Core\Extension\Extension->__construct('/app/docroot', 'module', 'modules/custom/...', 'xeno_hero.modul...')
#2 /app/docroot/core/lib/Drupal/Component/DependencyInjection/Container.php(259): Drupal\Core\Extension\ModuleHandler->__construct('/app/docroot', Array, Object(Drupal\Core\Cache\ChainedFastBackend))
#3 /app/docroot/core/lib/Drupal/Component/DependencyInjection/Container.php(173): Drupal\Component\DependencyInjection\Container->createService(Array, 'module_handler')
#4 /app/docroot/core/lib/Drupal/Core/DrupalKernel.php(586): Drupal\Component\DependencyInjection\Container->get('module_ha in /app/docroot/core/lib/Drupal/Core/Extension/Extension.php on line 67
 [warning] Drush command terminated abnormally.

Any thoughts? Thanks!

albertski commented 3 years ago

@jsibley2 It looks like the module wan't uninstalled prior to the removal. You may want to add it back in, uninstall it, and then remove it.

jsibley2 commented 3 years ago

Sorry, that was it. Thanks!

acroundtree commented 2 years ago

I'm trying to use the commands above to install xeno hero using composer, however when I do there's nothing to install or update. Nothing comes from the repository despite the composer.json file updating.

albinsopaj commented 1 year ago

I'm getting this error after doing the following procedure: uninstalled Simple OAuth module -> cleared the cache via admin pannel -> run the command composer remove drupal/simple_oauth.

Would appreciate any help. Thanks.

The website encountered an unexpected error. Please try again later.
AssertionError: The file specified by the given app root, relative path and file name (/usr/www/users/lsmrk/modules/contrib/consumers/consumers.info.yml) do not exist. in assert() (line 73 of core/lib/Drupal/Core/Extension/Extension.php).
assert() (Line: 73)
Drupal\Core\Extension\Extension->__construct() (Line: 114)
Drupal\Core\Extension\ModuleHandler->__construct() (Line: 259)
Drupal\Component\DependencyInjection\Container->createService() (Line: 177)
Drupal\Component\DependencyInjection\Container->get() (Line: 588)
Drupal\Core\DrupalKernel->preHandle() (Line: 46)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 704)
Drupal\Core\DrupalKernel->handle() (Line: 19)
albinsopaj commented 1 year ago

I'm getting this error after doing the following procedure: uninstalled Simple OAuth module -> cleared the cache via admin pannel -> run the command composer remove drupal/simple_oauth.

Would appreciate any help. Thanks.

The website encountered an unexpected error. Please try again later.
AssertionError: The file specified by the given app root, relative path and file name (/usr/www/users/lsmrk/modules/contrib/consumers/consumers.info.yml) do not exist. in assert() (line 73 of core/lib/Drupal/Core/Extension/Extension.php).
assert() (Line: 73)
Drupal\Core\Extension\Extension->__construct() (Line: 114)
Drupal\Core\Extension\ModuleHandler->__construct() (Line: 259)
Drupal\Component\DependencyInjection\Container->createService() (Line: 177)
Drupal\Component\DependencyInjection\Container->get() (Line: 588)
Drupal\Core\DrupalKernel->preHandle() (Line: 46)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 704)
Drupal\Core\DrupalKernel->handle() (Line: 19)

Solved it.