Wednesday, March 20, 2019

[success] No site aliases found. drush 9

[success] No site aliases found. drush 9

Running drush sa returns below message in drush 9?

[success] No site aliases found.

Here is the solution:
NOTE: Tested with drush installed globally

Run drush debug command:
drush st --debug -vvv
 Sample output from above:

 [preflight] Config paths: /home/sastha/.composer/vendor/drush/drush/drush.yml
 [preflight] Alias paths:
 [preflight] Commandfile search paths: /home/sastha/.composer/vendor/drush/drush/src
 [bootstrap] Starting bootstrap to max [0.3 sec, 7.64 MB]
 [debug] Trying to bootstrap as far as we can [0.3 sec, 7.64 MB]
 PHP binary    : /usr/bin/php7.2
 PHP config    : /etc/php/7.2/cli/php.ini
 PHP OS        : Linux
 Drush script  : /home/sastha/.composer/vendor/drush/drush/drush
 Drush version : 9.6.0
 Drush temp    : /tmp
 Drush configs : /home/sastha/.composer/vendor/drush/drush/drush.yml


Alias Path is missing as highlighted above


Sample drush.yml content:
sastha@DESKTOP $ cat /home/sastha/.composer/vendor/drush/drush/drush.yml
#This is a Drush config file. Sites may override this config to change minimum PHP.
drush:
  php:
    minimum-version: 5.6.0
  paths:
    alias-path:
     - /home/sastha/sites

Check if alias-path is set?

sastha@DESKTOP $ drush st --debug -vvv
 [preflight] Config paths: /home/sastha/.composer/vendor/drush/drush/drush.yml
 [preflight] Alias paths: /home/sastha/sites
 [preflight] Commandfile search paths: /home/sastha/.composer/vendor/drush/drush/src
 [bootstrap] Starting bootstrap to max [1.47 sec, 7.64 MB]
 [debug] Trying to bootstrap as far as we can [1.48 sec, 7.65 MB]
 PHP binary    : /usr/bin/php7.2
 PHP config    : /etc/php/7.2/cli/php.ini
 PHP OS        : Linux
 Drush script  : /home/sastha/.composer/vendor/drush/drush/drush
 Drush version : 9.6.0
 Drush temp    : /tmp
 Drush configs : /home/sastha/.composer/vendor/drush/drush/drush.yml

Problem solved!

Yes formatting is bad because no one is reading my blog except me :) :) :)

Friday, March 1, 2019

Drupal 8 Composer failure on Windows 7 with the message "bin\phpcs" "--config-show" "installed_paths"" failed.

Drupal 8 Composer failure with the below message on Windows 7:

 ""D:\www\mydrupalsite/vendor/bin\phpcs" "--config-show" "installed_paths"" failed.

Solution: 

Save this as phpcs.bat inside D:\www\vendor\bin:

@ECHO OFF
setlocal DISABLEDELAYEDEXPANSION
SET BIN_TARGET=%~dp0/../squizlabs/php_codesniffer/bin/phpcs
php "%BIN_TARGET%" %*