Skip to main content
30 votes
Accepted

Composer keeps overwriting .htaccess (and other files) every time I do anything

That's Drupal's Composer Scaffold. Listed as "drupal/core-composer-scaffold": "^8.8.0" or a different version in your project's composer.json file. To prevent certain scaffold files from being ...
leymannx's user avatar
  • 18.3k
29 votes
Accepted

How can I force Composer to install a dev branch over a stable release?

While it will install the latest dev release of the Drupal module/theme to simply do the following: composer require drupal/bootstrap:3.x-dev I would argue a best practice when installing a dev ...
Duncanmoo's user avatar
  • 2,951
26 votes

"Uncaught ReflectionException: Class DOMDocument does not exist" error

DOMDocument is included in the extension php-xml. To install it on ubuntu, run: sudo apt-get install php-xml
greg_1_anderson's user avatar
24 votes
Accepted

composer require fails because it can't delete default.services.yml

Make your "local" machine work as intended, and maintain the security of your live site. Since you want to use composer require command only on non-production environments, the following ...
Kay V's user avatar
  • 648
22 votes
Accepted

Is Drush abandoned?

You have installed the development master branch of Drush. To continue using commands such as drush dl, drush pm-update and so on, you should install the 8.x branch of Drush. However, your basic ...
greg_1_anderson's user avatar
18 votes
Accepted

Require v8 only contrib module with v9 patch

Drupal 10 As reported by @rocketeerbkw, the official lenient endpoint in packagist currently doesn't support Drupal 10. https://github.com/mglaman/composer-drupal-lenient does. Instructions for use ...
Darvanen's user avatar
  • 4,093
18 votes

Composer not applying patch: exceeded the timeout of 300 seconds

Thanks @cilefen for pointing me in the right direction. For me solution 423 of this thread fixed the problem: https://github.com/cweagans/composer-patches/issues/423#issuecomment-1301026697 The ...
Joost's user avatar
  • 1,348
17 votes
Accepted

Trouble after updating to 2.0

In order to resolve the composer/installers ^1.7 issue you can require composer/installers ^1.9. More details can be found from Drupal's Preparing your site for Composer 2. composer require "...
Cosmo Martinez's user avatar
16 votes

How do I uninstall Drush?

You can use composer global remove drush/drush to uninstall a global Drush. Or use composer remove drush/drush to uninstall a project-local Drush.
Blake Morgan's user avatar
16 votes
Accepted

Installation error with Composer

Please make sure your webserver (nginx/apache) is using the same PHP version as your cli one. For example, you may encounter this issue if your cli PHP version is PHP 7.1 and your webserver is using ...
Renrhaf's user avatar
  • 638
16 votes

How do I apply a patch with Composer workflow?

First, run composer require cweagans/composer-patches Now you have a package installed that enables you to patch core, libraries or modules. Second, add a patch to a folder named 'patches' in the ...
Stef Van Looveren's user avatar
16 votes
Accepted

How to install multiple modules with composer at once?

You can write the names of multiple packages separated by spaces. For example: composer require drupal/adminimal_theme:^1.5 drupal/adminimal_admin_toolbar:^1.9
Leigh's user avatar
  • 2,963
16 votes

composer require fails because it can't delete default.services.yml

This command will fix it temporarily: chmod u+w web/sites/default But Drupal will harden permission again soon. To turn it off add this to settings.php: $settings['skip_permissions_hardening'] = TRUE;...
Bobík's user avatar
  • 461
16 votes
Accepted

How do I apply patches from a merge request?

If you look into the Issue queue you can see MR #54 is the latest code change. Go to the URL of the MR and add .patch at the end of the URL you will get the path to the latest patch. URL for your ...
miststudent2011's user avatar
15 votes
Accepted

Composer updates .htaccess file when updating

"extra": { "drupal-scaffold": { "source": "http://cgit.drupalcode.org/drupal/plain/{path}?h={version}", "excludes": [ ".htaccess", "robots.txt" ] } } Put this above code in ...
harsh_behl_0007's user avatar
14 votes

Drush CC all returning "No Drupal site found, only 'drush' cache was cleared"

There are a few things you can do to help debug your drush. Here is what you can try: Debug output Use drush cc all -vvv This will provide you with some valuable information in terms of what Drush ...
JNP Web Developer's user avatar
14 votes
Accepted

Error when attempting to create sync directory

Nothing wrong with that. It is recommend to have the config folder outside of the public web folder; Drupal just doesn't have that. To keep the installation simple for non-experienced users, it puts ...
Berdir's user avatar
  • 83.3k
14 votes

How can I install a beta version of a module?

This installs the latest beta-12 for me: composer require drupal/webform:5.0.*@dev You need to do a bit of translation from the Drupal version number. From Using Composer to manage Drupal site ...
Clive's user avatar
  • 167k
13 votes
Accepted

drupal/core vs. drupal/core-recommended

It's "core-recommended" as in "recommended to avoid having dependency-related trouble with core." Drupal core (and some of the contributed modules, but not all) has a variety of ...
Patrick Kenny's user avatar
12 votes
Accepted

Updating Drush with Composer

If you want to update your global installations of any package under composer, you can just do this: composer global update You don't need to navigate to .composer/vendor/drush/drush However: There ...
paul-m's user avatar
  • 2,505
12 votes
Accepted

How to install with composer external library that drupal module depends on

You should be able to include this package via composer by adding some repository info. Add a package definition to your repositories section in your composer.json. The resulting repositories section ...
sonfd's user avatar
  • 7,926
12 votes
Accepted

`composer require` fails because "Source directory docroot/core has uncommitted changes"

Explanation: The problem is that cweagans/composer-patches is applying patches to Drupal Core after cloning it, leading Composer to believe you've modified the affected files and therefore to prompt ...
TravisCarden's user avatar
12 votes
Accepted

Command to install Drupal 9 with Composer

create-project can take a version number, and recommended-project has some tags in for 9.x, so for example: composer create-project drupal/recommended-project mynewproject "9.0-beta1" Or if you just ...
Clive's user avatar
  • 167k
11 votes
Accepted

How to download a module hosted on GitHub via composer.json?

You need Composer Installers for that: { "name": "my-project", "type": "project", "repositories": [ { "type": "composer", "url": "https://packages.drupal....
Clive's user avatar
  • 167k
11 votes

Drush on production server without Composer

If you don't want composer in production on your server, you can run the composer commands locally to install Drush, then make sure to push the vendordirectory to the server. Make sure to also commit ...
Jaypan's user avatar
  • 17.6k
10 votes

How do I update core with Composer?

To update Drupal using Composer, you just need to move the "drupal/core": "~8.1" line from the replace section to the require section. At the end the content of the composer.json file is like the ...
apaderno's user avatar
  • 97.6k
10 votes

How do I apply a patch with Composer workflow?

The issue is that composer is applying patches using git apply which is not working for packages that are not installed from source. Therefore the solution is to install the packages from source. ...
Thomas Pappas's user avatar
10 votes
Accepted

Move my project from public_html/web to public_html

You should be able to change the installer paths in composer.json, which defines where the files are placed: "installer-paths": { "web/core": ["type:drupal-core"], "web/modules/contrib/{$name}": [...
Patrick Kenny's user avatar
10 votes

composer update drupal/drupal does not work : Nothing to install or update

Finally, i could update with these modifications. Step 1, optional in case your composer.jsoncontains this. If it is ok, apply step 2 add "require": { --- "drupal/core": "~8.5" ...
Sébastien Gicquel's user avatar
10 votes
Accepted

Is it possible to make a patch that modifies a module's composer.json?

This issue is actually addressed in the composer-patches documentation: Because patching occurs after Composer calculates dependencies and installs packages, changes to an underlying dependency's ...
Shawn Conn's user avatar
  • 26.9k

Only top scored, non community-wiki answers of a minimum length are eligible