Search code examples
phpdrupalcomposer-phpdrushdrupal-8

How to upgrade from drush 7 to drush 8 via Composer


I am working in a website with drupal and Neato starter base theme. Here the Docs (http://www.velir.com/blog/index.php/2015/08/28/neato-in-drupal-8-fundamentals/)

But, when I try to run:

$ drush ngt subtheme 

appears this error:

Drush 7.0.0-rc1 does not support Drupal . 
PHP Fatal error:  Call to undefined function Drush\Boot\conf_path() in /Applications/DevDesktop/drush/vendor/drush/drush/lib/Drush/Boot/DrupalBoot.php on line 360

I´ve tryed this steps (http://whaaat.com/installing-drush-8-using-composer) but not working,

I searched a lot on google but I'm tired, maybe I'm not looking right or I'm not reading it right.

This is my drush:

$ drush status
    PHP executable         :  /Applications/DevDesktop/php5_5/bin/php
    PHP configuration      :  /Applications/DevDesktop/php5_5/bin/php.ini
    PHP OS                 :  Darwin
    Drush version          :  7.0.0-rc1
    Drush temp directory   :  /tmp
    Drush configuration    :  /Applications/DevDesktop/drush/vendor/drush/drush/drushrc.php
    Drush alias files      :  /Users/myuser/.drush/my.aliases.drushrc.php /Users/myuser/.acquia/DevDesktop/Drush/Aliases/aliases.drushrc.php

Can anyone help me please?


Solution

  • I use this way to upgrade or downgrade the drush version:

    composer global require drush/drush:dev-master
    

    or you can edit manually the composer.json file:

    "require": {
        "drush/drush": "dev-master"
    }
    

    After it, if is the first time you are working with composer you have to install:

    composer install
    

    if not, update:

    composer update
    

    Finally, remove the previous executable file and create a link to the composer drush executable file. In my case I have it installed in my /home:

    rm -f /usr/local/bin/drush
    ln -s /home/<user>/.composer/vendor/drush/drush/drush /usr/local/bin/drush
    

    I hope this way can help you to configure the correct version of drush to work with Drupal 8.