Questions tagged [composer]
Use it for questions about the PHP application library dependency manager (Composer).
607
questions
20
votes
2
answers
42k
views
How can I force Composer to install a dev branch over a stable release?
I am experimenting with Bootstrap 3 in Drupal 8 and I want to stay on the dev branch of bootstrap.
In my composer.json, I wrote the following line based on Drupal Packagist:
"drupal/bootstrap": "8.3....
17
votes
2
answers
47k
views
How do I uninstall Drush?
There is a method of installing Drush via Composer.
composer global require drush/drush:dev-master
How do I uninstall it using Composer?
17
votes
5
answers
7k
views
What is the correct core update workflow?
I want to use composer to manage Drupal 8 dependencies, but I'm not sure what is the right core update workflow.
At the moment I'm using drush to update core to latest beta release, but I also have ...
15
votes
1
answer
5k
views
Composer keeps overwriting .htaccess (and other files) every time I do anything
Every time I try to update anything using Composer, it overwrites a load of files. One of the files it overwrites is .htaccess, which I have customised, so I have to keep patching it all the time. ...
14
votes
4
answers
19k
views
composer require fails because it can't delete default.services.yml
Using composer with Drupal (7, 8 & 9), composer require drupal/<package-name> returns the following error.
Installation failed, reverting ./composer.json to its original content.
[...
14
votes
3
answers
2k
views
Require v8 only contrib module with v9 patch
Given I have Drupal 9 composer installation with composer-patches plugin
and given a contrib module with a stable v8 release, but no v9 release (not even dev branch)
and given that contrib module has ...
13
votes
3
answers
30k
views
How do I apply a patch with Composer workflow?
I need to include a patch in my project. I have included cweagans/composer-patches in composer.json and added the following lines in the extra section (example is from when trying to enable ...
13
votes
2
answers
17k
views
Does "composer remove drupal/module" actually uninstall the module first?
Does composer remove drupal/module actually uninstall the module first, especially in multi-site environments?
On the other hand, does composer require "enable" the given module for all sites?
12
votes
11
answers
12k
views
Drush CC all returning "No Drupal site found, only 'drush' cache was cleared"
I've tried other solutions, but none of them are specific to my setup. I just started using the new Linux subsystem featured in the recent Windows 10 update. I'm using WAMP x64 v3.0.6, and have ...
12
votes
3
answers
15k
views
Trouble after updating to 2.0
I got a notice to update composer to 2.0 today and gave it a try, using "composer self-update --2". Now when I run composer update, I'm seeing this message.
The "grasmash/composerize-...
12
votes
2
answers
6k
views
Command to install Drupal 9 with Composer
The latest version of Drupal 8 can be installed via Composer with the following command:
composer create-project drupal/recommended-project mynewproject
What is the equivalent command to install the ...
11
votes
1
answer
2k
views
How do I apply patches from a merge request? [duplicate]
I used the patch #48 of Views exposed sort identifiers are not configurable. I need to update the core, and apply the latest rebased version of that.
However, the issue hasn't be marked Fixed, and I ...
11
votes
2
answers
671
views
Patch drupal.org project (core/module/theme) with issue fork
The new fork based merge request (MR) approach is pretty neat to get the patches created/reviewed/merged. However, if you are using the patch via cweagans/composer-patches, we have a few options.
...
10
votes
4
answers
5k
views
Why doesn't "composer update drupal/drupal" work?
I installed a Drupal 8.2.0 site with composer create-project drupal/drupal testsite.
Now I would like to upgrade it to Drupal 8.2.1. However, running composer update drupal/drupal doesn't work. It ...
10
votes
1
answer
6k
views
How do I update core with Composer?
Ok, admittedly I'm a composer novice. So, in my previous site, I used composer manager to update Drupal's core. That was pretty straight forward to use (just run "composer drupal-update"). However, ...
10
votes
1
answer
5k
views
Managing module library dependencies with composer
I've found Dependencies in a custom module with drupal-composer, How can I include a third party library in my custom module without using Composer Manager and How to manage contrib modules composer ...
9
votes
3
answers
9k
views
"Uncaught ReflectionException: Class DOMDocument does not exist" error
On Ubuntu 16.04, I installed Drush using Composer: composer global require drush/drush:~8. Installation succeeded, but running drush --version, I got this error:
PHP Fatal error: Uncaught ...
9
votes
2
answers
5k
views
drupal/core vs. drupal/core-recommended
I've got a question regarding drupal/core and drupal/core-recommended. So drupal/core-recommended uses fixed versions of the packages, which the corresponding core version was tested with. And yes it ...
9
votes
2
answers
3k
views
Disabling module with config sync and removing with composer
I have an issue disabling modules, I've searched but cannot find something useful:
- Developer A disable module and via composer remove it
- I pull his changes so i run composer install that remove ...
9
votes
1
answer
3k
views
`composer require` fails because "Source directory docroot/core has uncommitted changes"
Symptom: You have a script that fails while executing a composer require command, resulting in output like the following:
$ ./example.sh
Gathering patches for root package.
Removing package drupal/...
9
votes
4
answers
5k
views
Updating core from 8.2 to 8.3 via composer
I am trying to update Drupal core to 8.3 but am running into difficulties.
At the bottom of the page is the composer.json file I am starting with.
If i change "drupal/core": "~8.2" => "drupal/core"...
9
votes
1
answer
852
views
How can I install composer packages with drush make?
How does one include composer package in a drush make file?
The more general answer, the better. There's already a composer drush module allowing drush dl to handle composer packages, but that ...
8
votes
1
answer
3k
views
Is Drush abandoned?
I installed Drush via Composer (like the Drush site recommends). Every time I run drush dl drupal-7.x, I get a message telling me that I should use Composer.
[notice] dl has been deprecated. Please ...
8
votes
3
answers
7k
views
How can I install a specific core version?
Composer always installs the latest version of Drupal core, but I want Drupal 8.6, not Drupal 8.7.
How can I install a specific core version?
8
votes
1
answer
4k
views
How to download a module hosted on GitHub via composer.json?
I've got the following composer.json file:
{
"name": "my-project",
"type": "project",
"repositories": [
{
"type": "composer",
"url": "https://packages....
8
votes
1
answer
4k
views
how to install package via composer?
I would like to add library to my drupal 7 custom module. Library can be installed via composer, but i can't find a solution for install? How can i install this library? I have installed "composer ...
8
votes
3
answers
2k
views
Is it acceptable to modify Drupal's composer.json file?
Drupal adheres to the best-practice of never modifying core.
Drupal 8 has a composer.json file built into core, if you need to add a third-party library, should you modify composer.json, or is there ...
8
votes
2
answers
990
views
How do I include composer.libraries.json in root composer.json without using the wikimedia/composer-merge-plugin plugin?
In the recent update to Composer 2.0 the advice is to get rid of the wikimedia/composer-merge-plugin, which was even removed from the dependencies of Drupal core.
There is documentation on how to ...
8
votes
0
answers
1k
views
How to deploy Drupal 8 to production? [closed]
I've got a Drupal 8 site in dev that was put together with composer. I think I've got a solid grasp on the dependency injection bit although the details are murky. Now I want to deploy it to ...
8
votes
0
answers
3k
views
How do I update Drupal core on composer install? [duplicate]
I installed (or downloaded) drupal 8 via:
composer create-project drupal/drupal my_site_name 8.0.*
Which, at the time I ran it, downloaded Drupal 8.0.1. Now drupal 8.0.2 is available and I'd like ...
7
votes
3
answers
4k
views
Installation error with Composer
I'm trying to install Drupal 8 with Composer. Drupal Console is already installed (in case that's relevant), so I go to my localhost folder (working locally) and type:
composer create-project drupal-...
7
votes
3
answers
2k
views
Composer updates .htaccess file when updating
I am using composer with Drupal lightning. If I update Drupal via composer, it updates the .htaccess file.
Is there any way to prevent the .htaccess file from being overwritten?
7
votes
2
answers
11k
views
How can I install a beta version of a module?
Now, a good amount of modules do not yet have a stable version, for example, webform. composer require drupal/webform says:
Could not find package drupal/webform at any version for your minimum-...
7
votes
3
answers
9k
views
Undefined error: 0 OR Unable to load autoload.php. Drush now requires Composer
I've installed drush in /usr/local/lib/drush/drush and composer in /usr/local/bin/composer.
When I try to run drush /usr/local/lib/drush/drush I get the following:
/usr/local/lib/drush/drush: line ...
7
votes
2
answers
3k
views
How to patch your htaccess file correctly in composer.json
After running composer update my Drupal installation gets updated, but it also changes the content of the .htaccess file each time.
How can I correctly patch it?
7
votes
2
answers
10k
views
Installing Bootstrap theme using Composer
I am new to using Composer.
How can I install a theme, say https://www.drupal.org/project/bootstrap using composer
I've tried:
composer require drupal/bootstrap
But didn't work.
I also tried:
...
7
votes
1
answer
3k
views
Composer is git cloning modules instead of download them?
My composer file looks as follows:
{
"name": "drupal/drupal",
"description": "Drupal is an open source content management platform powering millions of websites and applications.",
"type":...
7
votes
1
answer
3k
views
Loading dependencies from the vendor directory in a module using composer
I am using composer for managing dependencies in my drupal module. I specified my dependency in the composer.json file placed in my module's root directory. After running the composer install comand ...
7
votes
2
answers
6k
views
How do I apply patch in vendor directory using composer?
Background:
Drupal 8
Managing dependencies with compose
I want to apply one patch to vendor/behat/web_api_extension project.
I tried with this in composer.json but it doesn't works or no error.
"...
7
votes
1
answer
147
views
Is there a good reason to prefer one method of installing over another?
Starting to play around with drupal 8. My first method of installing was installing drush8 (as mentioned in https://www.drupal.org/documentation/install/download):
Get drush8:
composer require ...
7
votes
1
answer
2k
views
How to manage contrib modules composer dependencies on drupal 8
Let's say I have a module exposing a composer.json file, composer manager let me merge it with others modules composer.json.
In Drupal 8 composer.json are used from the core, so is it possible to ...
6
votes
3
answers
8k
views
How to install with composer external library that drupal module depends on
Module bootstrap_languages depends on external library of same name how do we ask composer to require the external library that needs to go to libraries/bootstrap_languages folder
The project's ...
6
votes
1
answer
3k
views
Composer not applying patch: exceeded the timeout of 300 seconds [closed]
Since my update to the new OSX (Ventura 13) I'm having problems using composer. The biggest problem I have is that my patches aren't patched and end up with and exceeded the timeout of 300 seconds ...
6
votes
2
answers
13k
views
Updating packages with composer and knowing what to update
I'm just starting to work with Drupal 8 and composer and I'm trying to figure out how the updating workflow should work. I know the basics from administering a Drupal 7 server for years, but the ...
6
votes
1
answer
591
views
"Declaration of <function> must be compatible with <interface>" in Drupal 8.6.10
Up until Saturday I had a functioning Drupal 8.6.x instance. The I did
composer update
and Drupal 8.6.10 was installed. Since then I get the following in my error logs:
Declaration of Drupal\Core\...
6
votes
1
answer
605
views
What is the difference between drupal/drupal and drupal-composer/drupal-project packages?
I want to use composer with my future Drupal projects. I installed Composer on my machine and I noticed two packages (drupal/drupal and drupal-composer/drupal-project). When I install the second ...
6
votes
3
answers
188
views
What's the correct way to install Drupal with Composer if I want to work on core issues?
I want to install a local Drupal site in such a way that Drupal core is a git repository so I can work on patches.
Just doing a git clone doesn't work, because I also need tools such as Drush, and ...
6
votes
2
answers
9k
views
Updating core to a specific version with Composer
My site hasn't been updated for two months, a few new updates has been released.
My site's core version is 8.5.6.
Before running composer update -with-dependencies I read the release notes to the ...
5
votes
3
answers
2k
views
Drush on production server without Composer
I want Drush 9 on a Drupal 8 production server without having to install Composer. Is there any way to do this?
And if that is not possible, can anyone suggest an alternative to Drush especially for ...
5
votes
5
answers
10k
views
After installing composer: "The drush command X could not be found"
Edit: re-wrote intro paragraph to highlight the installation of composer - I suspect composer may have broken drush.
I want to test out elastic search with D7. I used drush to install a fresh D7 ...