28 votes
Accepted

How do I uninstall Drush?

It seems there is no single remove command, so you need to: Edit your composer.json file, e.g. vim ~/.composer/composer.json and remove line containing drush. Save the file. Update Composer PHP ...
  • 13.7k
28 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 ...
  • 2,808
25 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
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 ...
22 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 ...
  • 16.2k
20 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 ...
  • 570
17 votes
Accepted

Require v8 only contrib module with v9 patch

** Update 2 ** The official advice is now to use a specially made lenient endpoint as described in Using Drupal's Lenient Composer Endpoint. ** Update 1 ** Official advice found at: Use issue forks ...
  • 4,053
16 votes
Accepted

How to add JavaScript or CSS library to Composer project?

The library can be installed into a custom path by utilizing extra : installer-paths to for e.g.: web/sites/libraries/{$name} Additional to that, we define the required package repository with the ...
  • 301
16 votes

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

You can keep the original prefer-stable settings. The @dev in 8.3.*@dev is the stability flag for the given package. The easiest way to force a dev-version of a package is to use a different version ...
  • 656
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 ...
  • 628
15 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.
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 ...
15 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 ...
  • 164k
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 ...
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 ...
  • 81.7k
13 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
  • 2,874
13 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;...
  • 431
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 ...
  • 2,505
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 ...
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 ...
  • 164k
12 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 "...
11 votes
Accepted

What is the correct core update workflow?

I presume that you are using drupal-composer/drupal-project as the basis for your project. If not, take a look at that project, and compare it with yours. Also, you said that you want to use ...
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....
  • 164k
11 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 ...
11 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 ...
  • 7,212
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 ...
  • 94.9k
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. ...
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" ...
10 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 ...
  • 15.3k
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 ...
  • 26.4k

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