Problem/Motivation

I have installed D10 in Xampp PHP 8.2. And tried to install Drush using Composer command "composer require drush/drush". It throws an error and aborts the Drush installation in the project. The Drush version is 12.5.

Steps to reproduce

In D10 install Drush using composer.

Failed to extract drush/drush: (2) "C:\Program Files\7-Zip\7z.EXE" x -bb0 -y D:\xampp\htdocs\test\vendo
  r\composer\tmp-1d49dfb937dc41f3e0829579a977a55d -oD:\xampp\htdocs\test\vendor\composer\31afcf3e

  ERROR: Cannot create symbolic link : A required privilege is not held by the client. : D:\xampp\htdocs\
  test\vendor\composer\31afcf3e\drush-ops-drush-4aebed8\docs\contribute\CONTRIBUTING.md
  ERROR: Cannot create symbolic link : A required privilege is not held by the client. : D:\xampp\htdocs\
  test\vendor\composer\31afcf3e\drush-ops-drush-4aebed8\docs\drush_logo-black.png
  ERROR: Cannot create symbolic link : A required privilege is not held by the client. : D:\xampp\htdocs\
  test\vendor\composer\31afcf3e\drush-ops-drush-4aebed8\docs\img\favicon.ico
  ERROR: Cannot create symbolic link : A required privilege is not held by the client. : D:\xampp\htdocs\
  test\vendor\composer\31afcf3e\drush-ops-drush-4aebed8\docs\misc\icon_PhpStorm.png
CommentFileSizeAuthor
drush-error.png29.26 KBkumar ashutosh

Comments

Kumar Ashutosh created an issue. See original summary.

lic_morua’s picture

The error message indicates that your current user does not have the requisite privileges to create symbolic links when inserting Drush with Composer. The lack of privileges could be due to your user account type, or you might be running the command prompt without administrative rights.

You could try running the operation as an administrator to overcome this error. Below are the steps:

  1. Press the "Windows" key and type "cmd" or "Command Prompt".
  2. From the results, right-click on "Command Prompt" and opt to "Run as administrator" (you might need to confirm or key in a password).
  3. Once inside the command prompt, navigate to your project directory using the cd command (e.g., cd D:\xampp\htdocs\test\).
  4. After that, try running the Composer command once more (composer require drush/drush).

If you're facing challenges with the manual installation of Drush and other elements of a Drupal development environment, you might consider using DDEV. DDEV is an open-source tool that uses Docker to build a pre-packaged environment containing everything you need for Drupal development.

With DDEV, you don't have to worry about setting up Apache, Nginx, PHP, MySQL, Solr, or other services. Plus, it comes with Drush and other useful tools preinstalled.

To install DDEV on your machine, follow the instructions in the official DDEV documentation (https://ddev.readthedocs.io/en/stable/).

lic_morua’s picture

Status: Active » Needs work
kumar ashutosh’s picture

thanks @GafgarionMorua
Works fine.

gawalin’s picture

I am also facing the same issue. I tried installing Drush by running Command Prompt as an administrator, but it didn’t work.
Is there a solution other than using DDEV?

kumar ashutosh’s picture

@gawalin
Use Git Bash or Windows Powershell Run as administrator. It will work.

sk_10’s picture

The issue is still reproducible in Drupal 10.4.5 when running composer require drush/drush ^12.

I resolved it by following these steps:

  • Ran PowerShell as an administrator
  • Added the missing ZIP extension in php.ini:

extension=zip

After this, the command worked successfully.
Thanks.