2

I'm on an Amazon Linux machine.

I ran:

$ composer global require drush/drush
Changed current directory to /home/ec2-user/.composer
Using version ^8.1 for drush/drush
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating autoload files

Then I added composer into the PATH so it reads like this:

$ echo $PATH
/home/ec2-user/.composer/vendor/bin:/home/ec2-user/.composer/vendor/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/opt/aws/bin:/home/ec2-user/.local/bin:/home/ec2-user/bin

Then if I try this I get an error:

$ composer show drush/drush

  [InvalidArgumentException]
  Package drush/drush not found

show [--all] [-i|--installed] [-p|--platform] [-a|--available] [-s|--self] [-N|--name-only] [-P|--path] [-t|--tree] [-l|--latest] [-o|--outdated] [-D|--direct] [--] [<package>] [<version>]

And if I run the drush command the cursor stays there waiting:

$ drush

What did I miss?

3 Answers 3

1

So after a little investigation I realised I had a folder called drush in my home directory as well as something added by composed inside my home directory/.composer/vendor/bin/. I deleted these drush directories and ran composer again after which drush works fine.

[ec2-user@ip-... ~]$ ls
composer.json  drush  vendor
[ec2-user@ip-... ~]$ sudo rm drush
[ec2-user@ip-... ~]$ cd .composer/
[ec2-user@ip-... .composer]$ ls
cache  composer.json  composer.lock  vendor
[ec2-user@ip-... .composer]$ cd vendor/
[ec2-user@ip-... vendor]$ ls
autoload.php  composer  drush          nikic  psr  symfony
bin           dnoegel   jakub-onderka  pear   psy
[ec2-user@ip-... vendor]$ ls -la
total 52
drwxrwxr-x 12 ec2-user ec2-user 4096 May 12 07:25 .
drwxrwxr-x  4 ec2-user ec2-user 4096 May 11 20:59 ..
-rw-rw-r--  1 ec2-user ec2-user  183 May 12 07:25 autoload.php
drwxrwxr-x  2 ec2-user ec2-user 4096 May 11 20:59 bin
drwxrwxr-x  2 ec2-user ec2-user 4096 May 11 20:59 composer
drwxrwxr-x  3 ec2-user ec2-user 4096 May 11 20:59 dnoegel
drwxrwxr-x  3 ec2-user ec2-user 4096 May 11 20:59 drush
drwxrwxr-x  4 ec2-user ec2-user 4096 May 11 20:59 jakub-onderka
drwxrwxr-x  3 ec2-user ec2-user 4096 May 11 20:59 nikic
drwxrwxr-x  3 ec2-user ec2-user 4096 May 11 20:58 pear
drwxrwxr-x  3 ec2-user ec2-user 4096 May 11 20:59 psr
drwxrwxr-x  3 ec2-user ec2-user 4096 May 11 20:59 psy
drwxrwxr-x  6 ec2-user ec2-user 4096 May 11 20:59 symfony
[ec2-user@ip-... vendor]$ sudo rm -rf drush
[ec2-user@ip-... vendor]$ cd ../
[ec2-user@ip-... .composer]$ cd ../
[ec2-user@ip-... ~]$ composer global require drush/drush
Changed current directory to /home/ec2-user/.composer
Using version ^8.1 for drush/drush
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
  - Installing drush/drush (8.1.2)
    Loading from cache

    Skipped installation of bin drush for package drush/drush: name conflicts with an existing file
    Skipped installation of bin drush.launcher for package drush/drush: name conflicts with an existing file
    Skipped installation of bin drush.php for package drush/drush: name conflicts with an existing file
    Skipped installation of bin drush.bat for package drush/drush: name conflicts with an existing file
    Skipped installation of bin drush.complete.sh for package drush/drush: name conflicts with an existing file
drush/drush suggests installing drush/config-extra (Provides configuration workflow commands, such as config-merge.)
Generating autoload files
[ec2-user@ip-... ~]$ drush
Execute a drush command. Run `drush help [command]` to view command-specific help.  Run
`drush topic` to read even more documentation. ......rest of output ommited
0

Dunno if this helps but in my .bashrc I had to have

export PATH="$PATH:/root/.cache/composer/files/drush/drush"

Otherwise no workie at all. Running on opensuse

export PATH="~/.composer/vendor/bin:$PATH" 

#(assuming you run Drush under that root user account), or 
export PATH="/Users/<username>/.composer/vendor/bin:$PATH". 

Make sure you source ~/.bash_profile or .bashrc after making changes unless you start a new terminal session.

0

Skipped installation of bin drush for package drush/drush: name conflicts with an existing file

If Drush is not installed due to name conflicts, please check the value of your bin-dir by running composer config bin-dir command where your Drush may be present.

If you expect different location, make sure to unset COMPOSER_BIN_DIR shell variable before running Composer command as it may conflict with bin-dir defined in your composer.json file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.